correct problems with socket close

Do not send utp_closed message to reader until after all queued read data
has been delivered. Do not close a sender socket without trying to first
send all queued write data.