add cleanup function for menus that fires when the menu is no longer visible