No CRASH

made sure that there is no crash if the socket is closed