When you list your home for sale, the real estate agent requires you to sign a listing agreement.
This contract is not actually between you and that agent, it's between you and their boss, the Broker of their company.
That means that if your agent were to leave their real estate company, your contract with the broker still stands and they will simply assign another one of their agents to sell your home.
You may not be happy about the sudden change, but that's the contract. The broker is the one in charge.
Having my broker license allows me to have the freedom to keep my own listings!