title: Lucene .Net, do i need to close IndexWriter
body: <p>We are having locking issues with <code>Lucene .Net</code> throwing a <code>LockObtainFailedException</code>. It is a multi tenanted site and each customer gets their own physical search index on disc, and a <code>static</code> list of <code>IndexWriters</code> is used, one per index to control changes.</p>
  
  <p>We call the following functions on the <code>IndexWriter</code></p>
  
  <pre><code>AddDocument();
  DeleteDocuments();
  DeleteAll();
  Optimize();
  Commit();
  </code></pre>
  
  <p>I have noticed that we never call <code>Close()</code> or <code>Dispose()</code> on the <code>IndexWriter</code>, and wanted to know if this was good practice and could be the cause of the issues.</p>
  
  <p>Thanks Dave</p>