Fixed a crash when a menu is open and it's parent closes.