Changes to gzip buffer to fix not writing footer properly