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.