proper quitting when window is destroyed