Yes, you can always terminate the apartment in advance as long as it’s in accordance with the rental agreement.