Not sure how OpenForWrite works. Does it delete the content of the file or does it just start writing at position 0? If the latter is the case you might run into problems if you first pass in a bigger file and then a smaller. The second one would not fully overwrite the first one.