Walgreen’s (WAG) earnings fell slightly in the second quarter, as lower sales of generic drugs weighed on margins.

The nation’s largest drugstore chain also said it will close 76 locations in the second half, although Walgreen plans to increase its total store count by 55 to 75 by the end of the year.

Walgreen reported a profit of $754 million, or 78 cents a share, down from $756 million, or 79 cents a share, in the year-ago period. Excluding one-time items, adjusted earnings dropped to 91 cents from 96 cents.

Wall Street analysts were looking for adjusted earnings of 93 cents a share.

As previously announced, sales at the company’s drugstores jumped 5.1% to $19.61 billion, beating consensus estimates at the time.

Drugstores like Walgreen have struggled to keep up sales due to an increase in generic drugs, which cost less for consumers but bring higher margins than brand-name options. Walgreen saw a slowdown in generic drugs in the latest period, pushing its gross margin to 28.8% from 30.1%.

“Our second-quarter performance, in spite of expected headwinds from slower generic drug introductions, comparisons with last year’s flu season and severe weather, was marked by solid top-line growth driven by record quarterly sales and record second-quarter prescriptions filled,” CEO Greg Wasson said.

Same-store sales rose 4.3%, thanks to a 2% improvement at the front of the store and 5.8% growth for Walgreen’s pharmacies.

Comparable traffic was down 1.4%. Customers’ basket size climbed 3.4%.

Walgreen raised its projections for revenue and cost savings from its partnership with Alliance Boots, which operates the largest pharmacy chain in Europe. In the second quarter, Alliance Boots contributed eight cents a share to Walgreen’s adjusted earnings, at the high end of its guidance.

Walgreen acquired 45% of the Alliance Boots in 2012 and has an option to buy the remaining stake in 2015.

Shares increased 2.1% to $65.65 in pre-market trading on Tuesday.

Follow Matthew Rocco on Twitter @MatthewRocco