Add gzip support bugfix

Forgot to close the input file when using gzip. Oops.