Additional gzip filter improvements

Close the gzip output stream at the appropriate time. Improve when
logging happens.