Function isPathALoop

Checks if the first and last point are close enough to be considered a loop.