Insert touching node to the closest way segment

If a node "touches" more than one way segment, assign it to
the closest segment. Fixes a bug where multiple nodes near a
sharp polygon corner were incorrectly assigned to the first
available way segment instead of the best one, resulting in
self-crossing way.