HPCC-11541 Various IPT leaks, that also cause leaked locks

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Merge pull request #5954 from jakesmith/hpcc-11541

HPCC-11541 Various IPT leaks, that also cause leaked locks

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>