finish DFS traversal