Handle a WPF Exit Event
You can hook the event Closing on your main window like this -
<Window Closing="Window_Closing">
And in your event set the e.Cancel to true to stop the window from closing. In your case you can maintain some field which will be set once you get notification from client that he's done with cleanUp and its safe now to close the window. Simply set that value to e.Cancel
private void Window_Closing(object sender, CancelEventArgs e)
{
e.Cancel = true;
}