Perhaps it would help if you would (a) Open the file in read mode, and (b) use your file handle!
In reply to Re^3: "Updating" files. by roboticus in thread "Updating" files. by neutron