When you connect lines, lines are drawn between neighbouring endpoints.
To connect lines:
Select two or more lines.
Right-click and choose Modify - Connect.
To create a closed object, right-click a line and choose Close Object.
You can only use the Close Object command on connected lines, Freeform Lines and unfilled Curves.