A sale does not by itself end a residential tenancy at will. The buyer becomes the landlord, and the terms of a written lease still need to be considered. The sale alone does not give you possession or set a move-out date; if you are considering ending a tenancy, the lease and applicable notice and possession steps matter.
Massachusetts law requires you to transfer each security deposit and its accrued interest to the buyer. You must also credit the buyer for prepaid last month's rent and its accrued interest. Interest is 5% a year, or the lower amount the bank actually paid. Within 45 days after the transfer, the buyer must tell each tenant in writing that it now holds the money.
A proper transfer and written notice can release you from responsibility for the tenant's money; returning it to the tenant is another option. The buyer becomes liable to the tenant even if you do not hand the money over. Give the buyer the leases, deposit and prepaid-rent records, interest receipts, and tenant notices before closing.
Read the state sources: G.L. c. 186, § 13 (sale and tenancy at will) · G.L. c. 186, § 15B (deposits, prepaid rent, interest, and transfer) · Massachusetts Attorney General’s Guide to Landlord and Tenant Rights.