Refactor buildClosure()/rebuildClosure() methods

Use a single query technique to build new nodes or rebuild moved nodes