Ensure submodule repos and indices are freed

...before the helper's cleanup method tries to delete their files.