protected override void OnClose() { Flush(); _shuttingDown = true; Task.WaitAll(_activeTasks.ToArray()); _logEventStore.Dispose(); if (_timer != null) { _timer.Enabled = false; _timer.AutoReset = false; _timer.Stop(); } base.OnClose(); }