The retail company struck a rescue deal to save hundreds of stores, preserving thousands of jobs after filing for Chapter 11 bankruptcy.