fd.close() may be called on unassigned fd

In the "try" statement the call to file(fname, 'rb') may fail to various reasons, however the exception that it throws gets lost due to the call to fd.close() as there is no fd which results in:

  File "C:\Python27\lib\site-packages\pefile.py", line 1810, in __parse__
UnboundLocalError: local variable 'fd' referenced before assignment