Updated tcp client to handle notifications

This is a non-backwards compatible change for JSON-RPC 1 as we now keep
the connection open idefinitly.
We need to do that in order to be able to recieve notifications (as we
cannot predict how many there will be).
Send proper error when closing connection

All outstanding requests should fail with an error, previously they
failed without error.