Replace writeData with ioutil.WriteFile

Thanks to Nigel Tao for the suggestion.