Fixed incorrect sockets behavior on Ctrl-C