tools/ffhash: close file handle on error