Writes to file during processing