net: fix/make sure that connected if closing that.
net: better error message
`net_write2`: writes buffer with a specified length
if bson buffer you wanna send, the correct length of the
buffer is not `strlen(buf)`, it is in a specified function
for compute the length of your given buffer.
Then add a new function `net_write2` to do so.