You and your landlord can agree at any time that your tenancy can end. This is called a ‘surrender’.
If you are a joint tenant, you need the agreement of the other tenants as well as your landlord in order to surrender the tenancy. Get your landlord’s agreement in writing to avoid any dispute later on.
Just putting the keys through the landlord’s letter box or abandoning the property does not end your tenancy. If you don’t surrender your tenancy properly, you will still have to pay the rent.