During listFiles in the shell, if a file is being deleted as it is being enumerated via the Windows Find File or other file api, the api call may fail with ACCESS_DENIED if the file is opened for delete. Since ACCESS_DENIED is a generic error message for a lack of permissions, we cannot simply retry at the lowest level for this error as the user may also simply not have permission to the file according to the DACL on the file.
The DeleteFile function marks a file for deletion on close. Therefore, the file deletion does not occur until the last handle to the file is closed. Subsequent calls to CreateFile to open the file fail with ERROR_ACCESS_DENIED.