A lease is a contract. The tenant promises to meet the obligations of paying rent for the period specified in the lease. If the tenant moves out prior to the end of the lease without the agreement of the landlord or without justifying circumstances, the landlord may keep the security deposit to cover the unpaid portion of rent and may then sue the tenant for the remaining rent due for the balance of the term of the lease.
The landlord has an obligation to make an effort to re-let the unit. This is called "mitigation of damages." If the tenant surrenders the unit to the landlord and the landlord accepts the surrender and terminates the lease, the tenant is relieved of the responsibility to pay all future rents, unless the lease expressly and clearly provides otherwise.