Issue #104 - Moving drainBuffer() call to execute after socket is closed

I believe that the drainBuffer() method should be executed after the socket is closed, to get a new fresh socket.