HPCC-8682 - Fix deadlock with BUILDINDEX in LOOP

BuildIndex not resetting some states on rerun

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

HPCC-8682 - Fix deadlock with BUILDINDEX in LOOP

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>