[algorithms][for_each] fix bug with for_each_segment for open geometries

`for_each_segment` was not considering the last implicit segment of open geometries
The patch in this PR fixes this bug, by considering the `closeable_view` of the range.