Harry this should all be spelled out for you by your realtor. It should be very clearly defined by either your purchase agreement or by necessary addendums to the purchase agreement.
One method that is generally used is that a standard lease is drawn up by the new owners and you sign that lease as a tenant. The security deposit can be delivered from escrow to the new homeowner (as it is essentially deducted from your proceeds) and so can the first months rent.
This protects everything such that nothing becomes effective until you actually become a tenant.