tests: explicitly close index connections

This avoid having too many connection when running multiple tests in
parallel.

Change-Id: I8f491ebb7ec86d37c3808623f94ac4a01f5b20ed