>Definitely not file name collision because there's a strict naming convention for these files that includes a primary key value as part of the file name. And there's now code that ensures that if a file of the same name exists, we close it and delete it before creating.
Just thinking... if there's a previously existing file, its deletion is actually passed to the OS, which may execute it in a separate thread. I've seen (long ago, on a slower machine) situations when the previous file would still exist at the time the new one was created - and when debugging it was impossible to re-create,simply because debugging give the other thread the time to complete its task.
To check this, check in the logs if deletion is related to the error. I seem to remember that in such a case I wrote a loop where I'd try to fcreate() the file, and sleep a dozen milliseconds until it succeeded. Then I'd just fclose() the handle and go on.
Note that "seem to remember" does not guarantee that my context is the same as yours.