title: How to exit all running threads?
body: <p>The following code does not exit the application. How can I exit the application and make sure all the running threads are closed?</p>
  
  <pre><code>foreach (Form form in Application.OpenForms)
  {
      form.Close();
  }
  Application.Exit();
  </code></pre>