public void Dispose() { if (writer != null) { writer.Dispose(); writer = null; } if (spreadsheet != null) { spreadsheet.Dispose(); spreadsheet = null; } }