Walgreens and other retail pharmacies have suffered in recent years from smaller revenue from prescription drugs and staffing shortages, amid competition with Amazon's online pharmacy business.