Unless otherwise agreed, a landlord who conveys premises that include a dwelling unit subject to a rental agreement in a good faith sale to a bona fide purchaser, landlord or agent, or both, is relieved of liability under the rental agreement and this chapter as to events occurring subsequent to written notice to the tenant of the conveyance and transfer of the security deposit to the bona fide purchaser.