Programmatically close context menu

Went searching again and found this post: Show/Hide context menu for node - #8 by walter and applied the solution there and it is now working.

Maybe a documentation update would benefit everyone here.