Your tenancy agreement is a legal contract and you are bound by the agreement until it expires. If you leave before the contract expires, your landlord can sue you for any outstanding rent. However, the landlord is bound by the contract in the same way that you are. If you feel the landlord has materially breached the agreement, you can use this argument to defend yourself at court.