finish bidirectional search