Added a safety feature to hide the menu when the main screen is selected and the menu is visible