i think the file has to be open for output.