the last point never added to chunked path

When pushing latlngs into the chunkedLatLngs the last point (latlngs[len-1]) never added. I think you need to add chunkedLatLngs.push(latlngs[len-1]) or chunkedLatLngs.push(next) before return