Added code to test file extension as well as type

is_gzip tests the file type, but there is a small chance that the
file might be a gzip and not end in '.gz'. This rare case should no
longer be a problem.