Do you use a custom closest heuristic?  My suggestion would be that we don't allow custom scoring for closest (unless if there is an important use case that I'm missing).  If we did this, then the implementation would be quite easier - all we would need to do is set `closestNode` if `neighbor.g < closestNode.g`, and we don't need all the additional `c` tracking.