Handle premature socket termination