Is there a way to detect if I can delete a file without handling a error? This has come up a few times, the last time being we have scripts we generate (replace a default username with an incremented username) and then perform another similar operation on resulting file. The problem is that if you don't do some wait time in between then the first file you create is not always done writting when you try and get it again for the second operation. Is there any way to detect that nothing is writing to the file?