title: System.Data.SQLite Close() not releasing database file
body: <p>I'm having a problem closing my database before an attempt to delete the file.   The code is just</p>
  
  <pre><code> myconnection.Close();    
   File.Delete(filename);
  </code></pre>
  
  <p>And the Delete throws an exception that the file is still in use. I've re-tried the Delete() in the debugger after a few minutes, so it's not a timing issue.</p>
  
  <p>I have transaction code but it doesn't run at all before the Close() call. So I'm fairly sure it's not an open transaction.  The sql commands between open and close are just selects.</p>
  
  <p>ProcMon shows my program and my antivirus looking at the database file.  It does not show my program releasing the db file after the close().</p>
  
  <p>Visual Studio 2010, C#, System.Data.SQLite version 1.0.77.0, Win7</p>
  
  <p>I saw a two year old bug just like this but the changelog says it's fixed.</p>
  
  <p>Is there anything else I can check?  Is there a way to get a list of any open commands or transactions?</p>
  
  <hr>
  
  <p>New, working code:</p>
  
  <pre><code> db.Close();
   GC.Collect();   // yes, really release the db
  
   bool worked = false;
   int tries = 1;
   while ((tries &lt; 4) &amp;&amp; (!worked))
   {
      try
      {
         Thread.Sleep(tries * 100);
         File.Delete(filename);
         worked = true;
      }
      catch (IOException e)   // delete only throws this on locking
      {
         tries++;
      }
   }
   if (!worked)
      throw new IOException("Unable to close file" + filename);
  </code></pre>