Modified with-open statements to account for lack of context manager in gzip for 2.6