Fix to gzip behavior on short files (<1MB).

This is an initial commit that fixes gzip behavior to write all data, including data after the program is finished. Changes and comments welcome.