Wall Street ends losing streak, led by energy