Refactor to use dispatch_io for tasks, and wait for EOF

Hopefully resolves #139, #135, #161.

/cc @joshaber @keithduncan
I don’t think we should use the stop option here, if your input signal sends data and then completes immediately the bytes might not get written