Problems with using vtkTubeFilter

I’m trying to draw a rectangular ring, obese when closed?

    idx = 6
    l = 1
    w = 1
    dr = .1
    points = vtkPoints()
    points.InsertNextPoint(0, w/2, 0)
    points.InsertNextPoint(0, w, 0)
    points.InsertNextPoint(l, w, 0)
    points.InsertNextPoint(l, 0, 0)
    points.InsertNextPoint(0, 0, 0)
    points.InsertNextPoint(0, w/2, 0)
    line = vtkPolyLine()
    line.GetPointIds().SetNumberOfIds(idx)
    for i in range(0, idx):
        line.GetPointIds().SetId(i, i)

    lines = vtkCellArray()
    lines.InsertNextCell(line)

    polyData = vtkPolyData()
    polyData.SetPoints(points)
    polyData.SetLines(lines)

    tubes = vtkTubeFilter()
    tubes.SetInputData(polyData)
    tubes.SetRadius(dr)
    tubes.SetNumberOfSides(30)

    mapper = vtkPolyDataMapper()
    mapper.SetInputConnection(tubes.GetOutputPort())

    cubeActor = vtkActor()
    cubeActor.SetMapper(mapper)
    # The usual rendering stuff.
    camera = vtkCamera()
    camera.SetPosition(0, 0, 1)
    camera.SetFocalPoint(0, 0, 0)

    renderer = vtkRenderer()
    renWin = vtkRenderWindow()
    renWin.AddRenderer(renderer)

    iren = vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)

    renderer.AddActor(cubeActor)
    renderer.SetActiveCamera(camera)
    renderer.ResetCamera()

    renWin.SetSize(600, 600)
    renWin.SetWindowName("Cube")

    # interact with data
    renWin.Render()
    iren.Start()


Any suggestions???