Close the gzip/deflate writer to avoid junk section after flush.