Wall Street capped a choppy day of trading on Tuesday with slight gains for stocks, leaving the major indexes just below their recent all-time highs.