Listening to QUIT events correctly