Bottom line: The Lease Company, not the dealership, holds the Title to your leased Leaf. Therefore, as long as the Lease Company gets their money's worth out of the transaction, according to agreed upon lease-return payoff amount or the car turned in to them, that is all you have to worry about. Dealership is not a player here. Not in the game!
Since the dealership the Leaf came from actually sold the new car to an agency (the lessor who owns the title all along), the Leaf technically has nothing to do with the dealership once it was sold to the title holder. You can return a leased Nissan to any Nissan dealership as a customer convenience, nothing more, and the lessor (title holder) has to come and claim the car after it's turned in. Or, the payoff amount $$ must be in the Lessor's pocket, not the dealership. Lessor owns the car after all. Simple as that. Dealership does not own the car.
I've sold to CarMax 2 years ago. I sold a '15 Ford C-Max Hybrid to carMax. Not a lease. They gave me slightly better than a trade-in value. I did lose a bit, but it saved me time, very quick and easy, professional operation. I'm having a hard time believing that CarMax can beat the payoff amount on a used Leaf lease-return. Used Leafs are cheap these days due to advancing battery tech and cheap new Leafs.
CarMax gets you a check quick, and I think they can cut 2 checks to you: One to pay off the Lease, and one to you for the residual. Sounds like a good deal Ask CarMax about the 2 checks thing. In reality, they are transferring ownership from the Lease Company (Nissan or a surrogate here) to CarMax. You never appear on any title. It's a little strange because you are getting a bonus but never own the car, I guess kind of like a broker's sales commission in a way.
Call one CarMax, and if you don't get a clear answer or they put you on hold forever, then call another location in your same state, somebody can figure it out there. They are Experts in this, they do it all the time.
Write back here and let me know how it went. I just turned in an '18 Equinox on a 3 year lease late in '20, and now I wonder if I should have attempted something like you are doing. I seem to remember the payoff (really used-car purchase amount) was higher than I thought the car was worth on the open market, so I doubt it would have worked for me.