public void LogStop(SessionStopped e) { if (_writer == null) { return; } if (Annotater == null) { _closeWriter = new Task((x) => ((LogFileWriter)x).Save(), _writer); _closeWriter.Start(); } else { if (Annotater.QualifiesForStorage(this)) { _closeWriter = new Task((x) => { ((LogFileWriter)x).Save(); Annotater.Store(this, ((LogFileWriter)x)); }, _writer); _closeWriter.Start(); } else { _writer.Clear(); } } _writer = null; }