FWIW, pre-agreed termination agreements like this are void in Ontario. I suppose it's to avoid exactly the situation you describe.
Once you sign a lease you and roll on month-to-month it's unlikely you will be evicted. Landlords either need to sell the property or move into it themselves to get the property back.