Writing hash to file