Close the file after hash completion
Added non-blocking hash function