modified listener to write gzipped files