properly shutdown ssl sockets