Fix ropey error handling. Handle io.EOF correctly (I hope).