Fix 10038 errors / buffer loss from premature socket close