Well, a socket never close itself afaik, it's either you or the person you're connected to that close it, but I guess losing the internet connexion is also a way.