Usually you should be ok if you move out of town
Legally, the landlord has the right to get paid until the end of the lease. But by the same time, if you have a good reason to move out of town, the landlord has also the responsibility to actively re-rent the house. Usually, it means that the landlord can only charge you two month's vacancy time.
The other part is, will the landlord spend the time and energy to sue you for the remaining rent?
