HPCC-8282 - Fix deadlock with BUILDINDEX in LOOP

BuildIndex not resetting some states on rerun

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>