fix closing window