Refactor writeFile as wirte_file

Lots of function called write.* so auto completion can be awkward. Find
write_file better satisfies my fingers.