As far as I understand, Python doesn't have block-level scoping.  If it's defined, then it's available until the function exits (or you explicitly delete the variable).

I would:
* Define `zfile = None` outside the try-catch
* Remove the "except" block
* Add a "finally" block, with  `if zfile: zfile.close()`