[PATCH v2 4/6] tcp: Fix closing logic for half-closed connections