Fix a bug where I was only copying the first block of data to the temporary file, rather than all of them.