Windows 7 permissions are much more restrictive. We had to modify our agents that create files.
Are you the agent signer?
If the file already exists, you need to kill it before writing the new file. And make sure you have error trapping.
For example, I added a line to kill the file name that I am going to write. And in my error handler, I had to trap for the error that would occur if the file didn't exist to kill (Err = 75)