private void windowClosing(Object sender, CancelEventArgs e) { if (!closeReally) { e.Cancel = true; //don't close as such this.Visibility = Visibility.Hidden; } if (heardWindow != null) { heardWindow.Close(); heardWindow = null; } if (keyWindow != null) { keyWindow.Close(); keyWindow = null; } }