With the Direct Select tool drag-select the two endpoints you want to join. Then click the join icon in the contextual menu below your artwork or select join from the right menu bar.
I am not able to select 2 endpoints. It only allows me to select one end point. What am I doing wrong?
Are you dragging a marquee selection around the two points? Don't click directly on either of them.
P.S. I updated the title of the thread to correct a typo.
It looks like you are using the Selection tool, not the Direct Selection tool. The Selection tool selects the entire object, while the Direct Selection tool will select just the anchor points.
The Direct Selection tool is just below the Selection tool in the toolbar:
When I select the points the joining tool does not show up.