Avoid file clobbering

Clobbering a file with > at the same time you're trying to read from it will often leave you with an empty file.