code: function endPolygon(coordCurr, normPrev, normNext, join_type, v, context) {
      // If polygon ends on a tile boundary, don't add a join
      if (isCoordOutsideTile(coordCurr)) {
          addVertex(coordCurr, normPrev, normPrev, 1, v, context, 1);
          addVertex(coordCurr, normPrev, normPrev, 0, v, context, -1);
          indexPairs(1, context);
      }
      else {
          // If polygon ends within a tile, add Miter or no joint (join added on startPolygon)
          var miterVec = createMiterVec(normPrev, normNext);
  
          if (join_type === JOIN_TYPE.miter && Vector.lengthSq(miterVec) > context.miter_len_sq) {
              join_type = JOIN_TYPE.bevel; // switch to bevel
          }
  
          if (join_type === JOIN_TYPE.miter) {
              addVertex(coordCurr, miterVec, normPrev, 1, v, context, 1);
              addVertex(coordCurr, miterVec, normPrev, 0, v, context, -1);
              indexPairs(1, context);
          }
          else {
              addVertex(coordCurr, normPrev, normPrev, 1, v, context, 1);
              addVertex(coordCurr, normPrev, normPrev, 0, v, context, -1);
              indexPairs(1, context);
          }
      }
  }
docs: End a polygon appropriately