socket: flush the write buffer before closing the socket (fixes #293)
Merge pull request #294 from lpinca/fix/gh-293

socket: flush the write buffer before closing the socket (fixes #293)