interactive-graph: close click-to-add polygons
interactive-graph: close click-to-add polygons

Summary:
This fixes the bug where polygons would load 'open' in the editor even
after they had been saved 'closed'. That is, if you saved a triangle
made in click-to-add-vertices mode, reloading the page would show just
two lines connecting three points, instead of a triangle.

This was caused by an incorrect check on creating the polygon editor,
which always created a new polygon as open if we were in click-to-add
mode. Insead, we now check for how many points we are adding with this
polygon, and if it is at least three, we close it, since any saved
polygon we are loading should be closed, and newly created click-to-add
polygons will have 0 points.

Fixes T2698

Test Plan:
Load [this local perseus item](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20interactive-graph%201%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22interactive-graph%201%22%3A%7B%22type%22%3A%22interactive-graph%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22step%22%3A%5B1%2C1%5D%2C%22backgroundImage%22%3A%7B%22url%22%3Anull%2C%22scale%22%3A1%2C%22bottom%22%3A0%2C%22left%22%3A0%7D%2C%22markings%22%3A%22graph%22%2C%22labels%22%3A%5B%22x%22%2C%22y%22%5D%2C%22showProtractor%22%3Afalse%2C%22showRuler%22%3Afalse%2C%22rulerLabel%22%3A%22%22%2C%22rulerTicks%22%3A10%2C%22range%22%3A%5B%5B-10%2C10%5D%2C%5B-10%2C10%5D%5D%2C%22gridStep%22%3A%5B1%2C1%5D%2C%22snapStep%22%3A%5B0.5%2C0.5%5D%2C%22graph%22%3A%7B%22type%22%3A%22polygon%22%2C%22numSides%22%3A%22unlimited%22%2C%22snapTo%22%3A%22grid%22%7D%2C%22correct%22%3A%7B%22type%22%3A%22polygon%22%2C%22numSides%22%3A%22unlimited%22%2C%22coords%22%3A%5B%5B-2%2C-2%5D%2C%5B2%2C-2%5D%2C%5B0%2C2%5D%5D%2C%22snapTo%22%3A%22grid%22%7D%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D)
and check that the polygon loads as closed in the editor.

Reviewers: charlie

Reviewed By: charlie

Maniphest Tasks: T2698

Differential Revision: http://phabricator.khanacademy.org/D10006

iamchenxin/perseus,iamchenxin/perseus,alexristich/perseus,abe4mvp/perseus,chirilo/perseus,abe4mvp/perseus,learningequality/perseus,ariabuckles/perseus,daukantas/perseus,junyiacademy/perseus,daukantas/perseus,learningequality/perseus,chirilo/perseus,ariabuckles/perseus,ariabuckles/perseus,sachgits/perseus,huangins/perseus,sachgits/perseus,junyiacademy/perseus,huangins/perseus,alexristich/perseus,ariabuckles/perseus