Fix crash if you try to close from the tray.