Fix socket close handling
Socket operations