Renting is a binding contract and it is not permissible for either of the two parties to cancel it by himself. But if both parties agree to cancel it, there is nothing wrong with that.
It says in al-Mawsooâah al-Fiqhiyyah (1/253):
The basic principle with regard to rental contracts, according to the majority, is that they are binding and neither party has the right to cancel the contract by himself except in the case of something that renders the binding contract null and void, such as discovery of a fault, or loss of the benefit for which rent is paid. And they quoted as evidence for that the words of Allah (interpretation of the meaning): âFulfil (your) obligationsâ al-Maaâidah 5:1.
It also says (1/272):
The majority of fuqahaâ do not think that rental contracts can be cancelled by excuses, because rental is one of the two types of financial transactions and the contract is binding; once the contract has been completed with the agreement of both parties, it cannot be cancelled except with the agreement of both parties. End quote.
Ibn Qudaamah said in al-Mughni (5/260):
Rental is a binding contract in which the landlord takes possession of the rent and the tenant takes possession of the benefits. If the tenant cancels the rental contract before the end of the rental period and gives up the benefits willingly, the rental contract is not cancelled and he still has to pay rent, and he is still the owner of the benefits, just as if he bought something and took possession of it and gave it up. Al-Athram said: I said to Abu âAbd-Allah: A man hired a camel and when he came to Medina, he said to him, Can we cancel the deal? He said: He does not have the right to do that; he is bound by the period of hired. I said: What if the one who hired it falls sick in Madeenah? He said: He cannot cancel it, because it is a binding contract between the two parties and neither party has the right to cancel it. Even if he cancels it, the obligation to pay the fee is not waived, as in the case of a sale. End quote.
Shaykh al-Islam Ibn Taymiyah said:
If the rental contract is valid, then it is binding on both parties. End quote.
al-Fataawa al-Kubra, 5/407
Based on that, if the owner agreed to cancel the contract, then he agreed to give up his right and you do not have to pay anything to him. But if he insisted on adhering to the contract between you, then he has the right to do that and you have to pay the rent for the rest of the rental period, and you may make use of the apartment or rent it out to someone who will use it as you would use it, until the end of the rental period.
See also the answer to question no. 82568.
And Allah knows best.