The relevant law in California is here. In your situation, it is presumed (as you both agree) that you have a month to month agreement. §1946 states that
A hiring of real property, for a term not specified by the parties, is
deemed to be renewed as stated in Section 1945, at the end of the term
implied by law unless one of the parties gives written notice to the
other of that party’s intention to terminate the same, at least as
long before the expiration thereof as the term of the hiring itself,
not exceeding 30 days;
In other words, the landlord has to give you 30 days advance notice to terminate the lease, and you have to give 30 days advance notice to terminate the lease (and it must be written notice). The section continues:
provided, however, that as to tenancies from month to month either of
the parties may terminate the same by giving at least 30 days’ written
notice thereof at any time and the rent shall be due and payable to
and including the date of termination.
which effectively says the same thing, specifically appliedd to month to month leases. There is some leeway on terminating a lease:
It shall be competent for the parties to provide by an agreement at
the time the tenancy is created that a notice of the intention to
terminate the same may be given at any time not less than seven days
before the expiration of the term thereof. The notice herein required
shall be given in the manner prescribed in Section 1162 of the Code of
Civil Procedure or by sending a copy by certified or registered mail
addressed to the other party.
But you would have to establish that there was such an agreement (I assume there was not).
§1946.1 asserts that
a hiring of residential real property for a term not specified by the
parties, is deemed to be renewed as stated in Section 1945, at the end
of the term implied by law unless one of the parties gives written
notice to the other of his or her intention to terminate the tenancy,
as provided in this section.
That is, a lease is automatically renewed in your situation unless notice has been given. Moreover,
A tenant giving notice pursuant to this section shall give notice for
a period at least as long as the term of the periodic tenancy prior to
the proposed date of termination.
What you are proposing contravenes this provision of the law – from your description of the facts, you did not give notice 30 days before now. So your obligation to the landlord exists to the end of May. Bear in mind that the law imposes obligations on both landlord and tenant: just as the landlord cannot throw you out without proper notification, you cannot walk away from your obligation without proper notification.
§1951.2 addresses breach of lease and abandonment by lessee (you)
if a lessee of real property breaches the lease and abandons the
property before the end of the term or if his right to possession is
terminated by the lessor because of a breach of the lease, the lease
terminates. Upon such termination, the lessor may recover from the
lessee:
(1) The worth at the time of award of the unpaid rent which had been
earned at the time of termination;
(2) The worth at the time of award of the amount by which the unpaid
rent which would have been earned after termination until the time of
award exceeds the amount of such rental loss that the lessee proves
could have been reasonably avoided;
(3) Subject to subdivision (c), the worth at the time of award of the
amount by which the unpaid rent for the balance of the term after the
time of award exceeds the amount of such rental loss that the lessee
proves could be reasonably avoided; and
(4) Any other amount necessary to compensate the lessor for all the
detriment proximately caused by the lessee’s failure to perform his
obligations under the lease or which in the ordinary course of things
would be likely to result therefrom.
There are, also, no special exceptions about landlords selling their property that allow instant termination.
That is, you still owe the month's rent, even though the lease is ending at the end of the month. You could of course ask the landlord to forgive you that last month's obligation. I am assuming that the lease was terminated properly by the landlord. If it was not, the landlord has not legally terminated the lease and it will continue until someone does properly terminate the lease. That might provide incentive for the other party to just forget the last month's rent, but it also might not.