title: C# WPF How to close a new window correctly?
body: <p>I have a simple question:</p>
  <p>1- Create a new WPF project, there's startup window in it: <code>MainWindow.xaml</code>.</p>
  <p>2- In this project, create a new window <code>Window1.xaml</code>.</p>
  <p>3- <code>Windows1</code>'s loaded event, let it close.</p>
  <p>4- Put an <code>Open</code> button to <code>MainWindow</code>. Implement it's click event.</p>
  <pre><code>private void Window_Loaded(object sender, RoutedEventArgs e)
  {
      this.Close();
  }
  
  private void button_Click(object sender, RoutedEventArgs e)
  {
      Window1 w = new Window1();
      w.Show();
  }
  </code></pre>
  <p>When I start this application, VS2015's UI became to the <code>DEBUGING MODE</code>, then I click the close button on the right top corner of the Window, VS2015's UI back to normal mode.</p>
  <p>Now, if I start application, click <code>Open</code> button, then <code>Window1</code> will show quickly and closed, but, if I click the close button on the right top corner of <code>MainWindow</code>, things different: VS2015 will no go back to normal mode but stay in <code>DEBUGING MODE</code>. so to me, that means something hang there and I don't know what is it.</p>
  <p>Is there anyone know how to fix this problem?</p>