The normal restrictions and regulations of the lease can be applied if both, you and your partner agree on leaving the flat. If both have signed the lease, it has to be terminated by both of you. It's easiest to count both rents together (former rent and new rents) and share the amount half each or according to the previous division: until termination of the lease / until a new tenant could be found.
If one of you want to remain in the flat, the other person has to pay his part of the rent until he moves out. You should randomly chose who can stay, if no one is willing to move out. Legally, no one has a privileged right to stay.