Walgreens beat Wall Street's earnings expectations but warned of a 'challenging retail environment'