title: DeleteFile fails on recently closed file
body: <p>I have a single threaded program (C++, Win32, NTFS) which first creates a quite long temporary file, closes it, opens for read, reads, closes again and tries to delete using <code>DeleteFile()</code>.</p>
  
  <p>Usually it goes smoothly, but sometimes <code>DeleteFile(</code>) fails, and <code>GetLastError()</code> returns  ERROR_ACCESS_DENIED. File is not read-only for sure. It happens on files on any size, but the probability grows with the file size.</p>
  
  <p>Any ideas what may be locking the file? I tried WinInternals tools to check and found nothing suspicious.</p>