Fixed closing path bug using Math.abs() to find the proximity of the coordinate