code: function(point, index) {
          var added = false;
  
          //remove last point
          var lastPoint = this.components.pop();
  
          // given an index, add the point
          // without an index only add non-duplicate points
          if(index != null || !point.equals(lastPoint)) {
              added = OpenLayers.Geometry.Collection.prototype.addComponent.apply(this, 
                                                                      arguments);
          }
  
          //append copy of first point
          var firstPoint = this.components[0];
          OpenLayers.Geometry.Collection.prototype.addComponent.apply(this, 
                                                                  [firstPoint]);
          
          return added;
      }
docs: Constructor: OpenLayers.Geometry.LinearRing
  Linear rings are constructed with an array of points.  This array
  can represent a closed or open ring.  If the ring is open (the last
  point does not equal the first point), the constructor will close
  the ring.  If the ring is already closed (the last point does equal
  the first point), it will be left closed.
  
  Parameters:
  points - {Array(<OpenLayers.Geometry.Point>)} points
   
  APIMethod: addComponent
  Adds a point to geometry components.  If the point is to be added to
  the end of the components array and it is the same as the last point
  already in that array, the duplicate point is not added.  This has
  the effect of closing the ring if it is not already closed, and
  doing the right thing if it is already closed.  This behavior can
  be overridden by calling the method with a non-null index as the
  second argument.
  
  Parameters:
  point - {<OpenLayers.Geometry.Point>}
  index - {Integer} Index into the array to insert the component
  
  Returns:
  {Boolean} Was the Point successfully added?