Wait for closing window