Adding a flush() call to the stream when writing data.  Not everything
seems to be getting written to file all of the time.