The discount giant also turned in better-than-expected second-quarter profits and saw a turnover in divisional leadership.