The File System can be a dirty rotten liar.
The variations include verify no one else has the file open, if the file is in use, the file is not writable, etc …. The answer to all of these questions is unfortunately the same. Simply put you can’t. The reason why is the fundamental nature of the file system prevents such predictive operations.
via blogs.msdn.com
Just a reminder from jaredpar. His idea is probably a good pattern to follow.