Update readme to include usage section, refactor doWrite() to use err properly