Documentation for tenants leaving early but still owing money

You require a deed of surrender.
You shall need to document the terms and conditions on their.
You may need to purchase one other than that on the open rent website if you wish to charge rent etc
I would suggest you take legal advice for that as you are chasing rent