Go to the settings > membership plans > setup a new plan / edit the current plan you would like to have an end date for. (This will only work for those signing up to the plan going forward)
Click the details tab
On contract length change the legnth to fixed end date then enter in the end date ensuring that it is 5 working days before a payment date.
Ensure cancel at the end of contract is selected.
Fill in the rest of the plan
This will then run the plan as normal however cancel the plan on this specific date.