PresentContextualMenu - how to close?

I cannot figure out how to close already shown contextual menu after i.e. WebButton.PresentContextualMenu
User can click on an item in this menu and selecting will close the menu. When user clicks elsewhere (beyond the area of menu) - the menu doesn’t close itself. Changing to other page keeps the menu displayed…

How to:

  1. close such menu programatically ?
  2. how to detect the menu is being displayed?