Close opened files on error
Remove unused variables
Fix mac signature hash table indexing