I am opening a WPF window from a tray app. I use the following code to open the window:
if (gui == null) { gui = new App();
You should try out the Closing event. This article provides useful information about when a WPF is actually closing (not just the window).