void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (client != null) { client.Connection.Send("/me > terminated."); client.Close(); client = null; } }