Cap Clip Ends

Anyone know of a way of capping the ends of a clipping function I created?

This is the function and a screenshot - open ends circled in red

Even a point in the right direction would be much appreciated.

Thanks