Auto-close paths when the first and last points are the same (fixes #48)