test: close stream immediately on error

If there is an error in the uv_read_cb, close the uv_stream_t
immediately instead of waiting until the uv_write_cb.