Fixing race condition bug that was losing content from the end of the stream
Adding new helper method for adjusting the max amount of data stored in memory before flushing as an S3 part