Avoid writing to socket after client closed socket
More tests