Added block getting executed before closing the menu