close window before quit