private void Window_Closed(object sender, EventArgs eventArguments) { DetectorsApp.TestAPCS.SpeedMsgStop(); try { if (/*exists (avoid first try exceptions)?*/ _businessManager != null) { _businessManager.Dispose(); } } catch { } finally { _businessManager = null; } try { if (/*exists (avoid first try exceptions)?*/ _dataAccess != null) { _dataAccess.Dispose(); } } catch { } finally { _dataAccess = null; } _eventLoggerAccess.LogWarning(Utilities.ProcessKill(Process.GetCurrentProcess().Id, true)); _eventLoggerAccess = null; }