avoid calling 'close' on a None object
Merge pull request #234 from tmclane/dont_close_none

avoid calling 'close' on a None object