Fix #Ref() & #Unref() usage

There were scenarios under heavy memory pressure where the connection would
be garbage collected before it was finished working because the #Ref() was released
after each query. This changes the behavior to hold a #Ref() to the object
-- and prevent garbage collection -- for as long as there is an open
connection to the backend. This prevents a bunch of weird, tricky
race-conditions, cleans up the code, and brings it in-line with how other
sockets behave. It properly blocks the event-loop until it's cleaned up.