made background index test + finalize into functions

Put the code that carries out tests on background built indexes,
and the code that replaces live indexes with background ones into
their own functions:
- `test_expectedResults()`
- `commit_backgroundIndexing()`

This should allow them to be called subsequently, without repeating
the indexing prodecure, which can take many hours to complete.