title: Closing a form view
body: <p>Earlier (with some much appreciated help), I was shown how to create a function that allows me to open a window (see below)</p>
  
  <pre><code>private void icon_Add(object sender, RoutedEventArgs e)
  {
      OpenView(typeof(viewName));
  }
  
  private void OpenView(Type newView)
  {
      if(typeof(Window).IsAssignableFrom(newView)) {
          Window window = (Window)Activator.CreateInstance(newView);
          window.Show();
      }
  }
  </code></pre>
  
  <p>I would now like to modify OpenView so that I can also tell it to close a form (and could really do with some help.  Ideally, I'd like to be able to run:</p>
  
  <pre><code> OpenView(typeof(viewName), typeof(viewToClose));
  </code></pre>
  
  <p>Thanks again.</p>