Fix error in goToNearestOpenEndNode.

Even javascript "use strict" doesn't help much.