The listing agreement and the buyer/broker agreement are both agreements between the client and the broker, not you, the agent. This means that unless your client and the broker agree otherwise, the deal stays with the brokerage when you leave. If your broker agrees to let you take the listing with you, you will need to submit a request through MLS’ Agent Listing Transfer program. But your old broker is not required to release the listing.
In either situation, the Independent Contractor Agreement that you signed when you began working at the brokerage will govern what happens to your commissions when you leave with pending transactions. Whether your old broker agrees to release the listing or not, your Independent Contractor Agreement will dictate if and how compensation will be paid for any pending transactions you may have.