Menubar: fixes #2775 hidesubmenu() worker function

Adds back in the `toplink` parameter which is used to determine if a
specific submenu should be closed rather than any open submenu.
Merge pull request #2776 from patheard/menubar

Menubar: fixes #2775 hidesubmenu() worker function