A judge gave Hostess Brands Inc. final approval to shut down its 85-year-old baking business and start selling off the pieces with up to $1.8 million earmarked as bonuses for managers overseeing the liquidation.

The company behind iconic treats such as Ho Hos and pantry staples like Wonder Bread now has the bankruptcy court's full blessing to start seeking buyers for its 30 brands and 36 plants with a skeleton staff at its helm. A group of the company's top executives—19 officers and high-level managers—deserve extra compensation as they wind down operations, Judge Robert Drain of the U.S. Bankruptcy Court in White Plains, N.Y., said at a Thursday hearing.

He cautioned those in his courtroom not to view the bonuses, which require the managers to hit certain milestones and goals, as a matter of management "feathering its nest."

"That is clearly not the case," Judge Drain said. "This is difficult work that is well compensated, not as a handout," as Congress intended when crafting laws to give companies in bankruptcy the greatest chance of success, he said.