Quarterly numbers suggested that the company’s strategy of layoffs, fewer store openings and more local emphasis was working.