Fixed unhandled exception for hashes

Hash function also only opens files in ReadOnly mode now