Walking away or posting the keys through the letterbox is called 'abandonment' and this does not end your agreement. If you do this your agreement with the landlord will continue even though you have left. This means your landlord can continue to charge you rent, so you're likely to build up rent arrears.
Your landlord could apply for a court order to make you pay what you owe. If this happens the court decides whether you should have to pay your landlord the money or not. If the landlord manages to let out the property they cannot claim rent from you after the new tenant moves in.
Abandonment may also make it harder for you to find a new home – most private landlords ask new tenants for references from previous landlords. Landlords will not be keen to rent to anyone who has previously abandoned a tenancy.
It is also important to make sure that you have somewhere to go when you leave. If you need to make a homelessness application after leaving, it could be decided that you are intentionally homeless because you left a home that you could have stayed in.