I have noticed that there is a Mouse_leave (I'm not sure of
the capitalization yet.) So even if there isn't a close event, you
could probably make something that approximates it by saving your
variables communicating with the server etc. when the user starts
heading for the close button.