Added safety check for gzipping to ensure file is not removed too soon