The accepted answer to this question is wrong. Node D is added to the open list (or open-nodes set) but not expanded immediately. The correct optimal path will therefore eventually be found. The algorithm does not stop when the target is added to the open list, but only when the target is expanded (i.e., selected as the minimum-cost node in the open list).