finish A* search