title: WPF Window is not set to null when closing it
body: <p>I'm developing a plugin which opens a <code>MainWindow</code> from the application. I'm using C# and WPF.</p>
  
  <pre><code>public class StartRIR : IExternalCommand
  {
      private static MainWindow mainwindow;
  
      public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
      {
          if (mainwindow != null)
          {
              mainwindow.Focus();
              return Result.Succeeded;
          }
          else
          {
              mainwindow = new MainWindow(commandData);
              mainwindow.Show();
              return Result.Succeeded;
          }
      }
  }
  </code></pre>
  
  <p>This code is executed when I call my external application, the goal is to avoid multiple <code>MainWindow</code>to open simultaneously. </p>
  
  <p>But if I close my window, I can't open it anymore. Does it mean closing a window do not set it to null? Do I have to override the <code>Closing</code> event or is there another way? </p>