HPCC-9253 Significant semaphore overhead in the unordered concat

Fix regressions from previous commit, related to incorrect output grouping,
and potential lockups.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>