Create a public variable and set it to false on closing the form, and test it in the event code.