title: When shutting down the application, not all windows are closed
body: <p>I have an application, where a create a new window for my graphic. I create it next way:</p>
  
  <pre><code>var thread = new Thread(() =&gt;
  {
      var win = new MyWindow();
      win.Show();
      Dispatcher.Run();
  });
  
  thread.SetApartmentState(ApartmentState.STA);
  thread.Start();
  </code></pre>
  
  <p>The problem is, that when I close Main application, additional window is still on and I need to close it manually. I set  <strong>ShutDownMode</strong> in my <code>App.xaml</code> to <code>OnMainWindowClose</code> and overrided <code>OnClosed</code>: </p>
  
  <pre><code>protected override void OnClosed(EventArgs e)
  {
      base.OnClosed(e);
      Application.Current.Shutdown();
  }
  </code></pre>
  
  <p>But it does not help me.</p>