When a wide menu is open and you move your mouse outside of it we have new code that prevents the immediate opening of neighboring menus. But while in this condition of mouse outside the menu, the rest of the event processing is not run, so pressing "escape" will not close it. This PR just moves the conditions around so event handling always continues unless another menu is opened. Pull Request: https://projects.blender.org/blender/blender/pulls/137243