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

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>