Removed 'U' from file opening mode due to problems with gzip