Walgreens plans to close at least 1,200 stores over the next three years as the pharmacy giant seeks to reduce costs and turn around operations under a new leader.