Always flush outputStream, regardless of instanceof FileOutputStream

The outputStream should always be flushed. If you only flush FileOutputStreams, you'll get file truncation errors when the files are read in. I think this is probably related to wrapping the FileOutputStream in a BufferedOutputStream. Perhaps the default value changed at some point.

I was getting intermittent File truncation errors, but now I'm getting good files.