Finding the closest visible vertex among line segments
I only noticed after posting that my first answer does not directly address your
specific question. So now my answer is in two parts.

(1) As suggested by @HEKTO, to find the closest segment,
you could first compute the Voronoi diagram:
CGAL 2D Segment Voronoi Diagrams.
Then next you need to perform point location within the (non-rectilinear) cells of the diagram.
That is also discussed, using "the segment Voronoi diagram hierarchy, a data structure suitable for fast nearest neighbor queries..."

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

 

CGAL figure.




(2) You specifically ask for the closest segment endpoint, which is not necessarily an endpoint of the closest segment:

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 


&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

Point $x$ is closer to segments $1,2,3,4$ than to the closest endpoint $y$.


For this you might need to look at
"visibility constrained Voronoi diagrams":


  Aurenhammer, Franz, Bing Su, Y-F. Xu, and Binhai Zhu. "A note on visibility-constrained Voronoi diagrams." Discrete applied mathematics 174 (2014): 52-56.
  Elsevier link.


I haven't studied this paper enough to be certain it solves your problem.
And perhaps there is a way to efficiently move from the closest segment to
the closest segment endpoint.