US stocks close strong, ending 3-day losing streak