error in closePossibleBorderAlgo