Selling the house does not by itself cancel the lease or require the tenant to move. The buyer becomes the successor landlord and takes over the rights and obligations for the tenants' rental deposits.
When your interest as landlord ends, you or your agent must, within a reasonable time, either transfer each deposit—minus any lawful deductions—to the buyer and notify the tenant of the transfer and the buyer's name and address, or return the deposit—minus any lawful deductions—to the tenant. Doing either ends your deposit liability.
If a tenant does not object within 20 days after written notice of the amount transferred, the buyer's duty to return the deposit is limited to that amount. The notice must include a stamped envelope addressed to the buyer.
Unless you agreed otherwise, after a good-faith sale you are relieved of lease obligations for events after the tenant receives written notice of the sale. Give the buyer the leases, deposit records, and tenant notices so the handoff can be handled correctly at closing.
Iowa Code: § 562A.12(5)–(6), rental deposits when the landlord's interest ends and § 562A.16, liability after sale.