Updated A* code to check if a node is already in open list