improve closing window