title: File is being used by another process
body: <p>I am developing a c# application, backend as sqlite.In my application i have an option for clean databse.It means the curren .db file will delete using File.Delete method and again it create empty databse using File.create method.Now let me explain the problem.</p>
  
  <p>To perform cleandatabse task, i have to stop all the process which is running ,after doing that if i click on clean database it is throwing an error that file cannot delete, it is being used by another process.i am able to stop all the thread which is running.</p>
  
  <p>Somehow i am able to find which process is blocikng the file ,</p>
  
  <pre><code>foreach (var process in Process.GetProcesses()) {
                  var files = GetFilesLockedBy(process);
                  if (files.Contains(filePath))
                  {
                      procs.Add(process);
                      Console.WriteLine(process.ProcessName);
                      process.Kill();
                      File.Delete(filePath);
                  }
              }
  </code></pre>
  
  <p>But in the above code i used process.Kill, which close the window form which i am running.
  without using kill, i tried close and dispose which doesn't work for me.</p>
  
  <p>Can you please help me to release the file from the process without closing the application and then yo delete the db file.</p>
  
  <p>Thank you in advance</p>
  
  <p>Best regards</p>
  
  <p>Sangita.</p>