@miriam98 - There are several options available to you when it comes to the termination of a rental agreement. The important thing is to discuss exit clauses and read all of the fine print and ask as many questions as possible.
The landlord does retain the upper hand, from the moment you sign the paperwork. So be sure you know what you’re getting into, and if you don’t like the terms, shop around.
Rentals nowadays seem desperate to find new people, given low mortgage rates, so I am sure that they will be flexible and willing to negotiate with you.