Fixed the output stream incomplete data by explicitly flushing the OutputStreamWriter

Fixed the output stream incomplete data by explicitly flushing the OutputStreamWriter

Don't readily have a unit test for this issue, as it only happens when there is a very large dataset, like in the tens of megs.  This fix has been tested in an enterprise production environment and is fully working.