this MIGHT be relevant ?

The file / folder is NOT guranteed to be deleted right after DeleteFile returns and succeeded.

http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx

However, the NT model for file deletion is that a file is deleted when the last open handle is closed.Ā¹ If DeleteĀ­File returns and the file still exists, then it means that somebody else still has an open handle to the file.

I think maybe you can trace the exact problem with ProcessMonitor.