in the pending acquisition’s completion. The company expects to finalize deals to divest its stores by the end of the calendar year.

In the most recent quarter, Walgreens earned $1.03 billion, up from only $26 million last year, when the company took a sizable hit from a change in the valuation of warrants for AmerisourceBergen stock that it exercised earlier this year.

Adjusted results in the most recent quarter came to $1.07 per share.

Analysts expected 99 cents per share, according to Zacks Investment Research.

Revenue came in nearly flat at $28.64 billion, which was shy of Wall Street forecasts for $29.17 billion.

The Deerfield, Illinois, company also said Thursday that it expects full-year, fiscal 2017 earnings to range between $4.85 and $5.20 per share.

That straddles the average analyst expectation for $5.03 per share, according to FactSet.

The Rite Aid deal is the latest in a string of acquisitions Walgreens Boots Alliance Inc. has announced in the past few years as it has grown to become a global pharmaceutical buying power. Walgreens has more than 13,000 stores around the world and a big presence in the United Kingdom thanks to its acquisition of European health and beauty retailer Alliance Boots. That deal closed about two years ago.

In March, Walgreens said it would spend nearly $1.2 billion to build its stake in AmerisourceBergen, the pharmaceutical wholesaler that supplies its drugstores, mail order and specialty pharmaceutical businesses.

Walgreen shares climbed more than 3 percent, or $2.61, to $79.79 Thursday afternoon, while broader indexes were flat.

The stock had tumbled more than 9 percent since the beginning of the year, as of Wednesday’s close.