Fix bug in polygon tool that adds an extra point
We remove the end point if it overlaps with the start point when create the path shape.
BUG:411059 (cherry picked from commit 4356f2a707ca30633abe39898c568599d15b1718)