The next morning the group goes back and forth between the cave and the Hispaniola carrying their gold to the ship.
Jim amuses himself by sorting the various coins from the treasure pile.
They don't see any sign of the three remaining pirates – Tom Morgan, Dick Johnson, and a third unnamed dude.
On the third night of this, Doctor Livesey and Jim are out walking when they hear some distant singing.
It's the pirates, either drunk or delirious with fever.
Doctor Livesey says that if he was sure it was fever and not drunkenness, he would go out and treat them, no matter how dangerous it would be to him personally.
Long John Silver replies that that would cost him his life – the pirates would never trust Doctor Livesey, even if he meant them no harm.
They set sail on the Hispaniola with the British flag flying.
As they pass the southern point of the island, they see all three of the pirates kneeling on the ground and begging to be taken aboard the ship.
They feel full of pity, but they don't want to take the risk of bringing the pirates on board. Plus, why save their lives just to bring them back to England to be hanged?
Doctor Livesey shouts to the three marooned pirates that they've left supplies and ammunition on the island for them.
The pirates keep begging to be rescued. As the Hispaniola sails out of earshot, one of them takes his gun and shoots right at Long John Silver.
He misses, but it's close.
Jim is glad to see Treasure Island disappearing in the distance.
They set sail for "Spanish America" (probably Central America or the Caribbean) to get a new crew to sail with them back to England.
Once they arrive at a friendly harbor, Doctor Livesey, Squire Trelawney, and Jim all head out for a night on the town to recover from their long, hard stay on Treasure Island.
Once they come back to the ship, Ben Gunn informs them that Long John Silver has run off. He admits that he helped Long John Silver into a rowboat to get away because he was afraid that if he stuck around they would never be safe.
Long John Silver managed to get away with one bag of treasure.
Everyone is relieved that he's gone.
They hire some crew members and get safely back to England just as Squire Trelawney's servant, Mr. Blandly, was thinking of sailing after them.
They all had lots of treasure to share among them, which they used pretty much as you would expect.
Captain Smollett retires from the sea.
Abraham Gray saves his money, buys shares in a boat of his own, and starts a family.
Ben Gunn receives his thousand pounds (in keeping with the deal he struck with Doctor Livesey), but spends it all in about nineteen days. He settles in the country and becomes a big churchgoer.
They don't hear anything more of Long John Silver, but Jim assumes that he's living his days happily with his wife and parrot.
There's still treasure on the island – silver and weapons – but Jim decides you couldn't pay him enough to go back.
Indeed, the worst dreams he has are of the waves on Treasure Island's coasts and the parrot Captain Flint saying, "Pieces of eight! Pieces of eight!" (34.26).