Jack in the Box plans to close dozens of restaurants by the end of the year in an effort to cut costs and boost revenue.