Wait for unwatch (and index clearing) to finish before getting the new project root

For #6540. The issue was that we were getting the Directory for the new project root before the old project root's index was cleared and the new root was watched. Since the old project root was a parent of the new project root in this case, that meant that another Directory object would be created for the same folder later on. The fix is to make it so we wait for the unwatch/index clearing to complete before getting the new root.

/cc @peterflynn