Update readme example to correctly handle files

As per the documentation in to.js, it is incorrect to rely on the 'end' event when writing to a file.  Utilize 'close' instead.