Added close endpoint procedure