The three major stock indexes in the United States made gains this week, rebounding some from weeks of losses for the best week since November 2020.