[PATCH v4 4/8] tcp: Fix closing logic for half-closed connections