There is no legally mandated waiting period once the contract with the agent has expired or been properly/legally terminated early. There is a practical reason to wait at least briefly, so as to avoid the agent trying to claim that the buyer actually first viewed the house while the agent was still in place or first saw the agent's listing for the home (e.g. the contract ends July 5th; if a buyer places an offer July 11th or 12th, you can be certain the agent will try to claim the commission, stating that given the timing, the buyer must have first became aware of the home during the agent's tenure).