Detecting GUI window close

Is there a way to detect when a GUI window has been closed ? I am building an editor tool and I need to perform some actions after the window has been closed. Ideally, if there is a callback or event that notifies me then that would be perfect. Are there any work arounds ? Thanks!

Since you are developing an editor tool I guess you mean you need to know when an editor window created by you is closed.

In this case you can use the EditorWindow.OnDestroy() method in which you can perform your actions in this method.