Fix #10375: reorder window operations in event handling

Fixes https://trac.openmicroscopy.org.uk/ome/ticket/10375

Test on both Mac and Windows.