Make menu only close if menu is open, stops another re-paint being performed in the browser