Stock market ends mixed, with S&P 500 shy of record on tariff relief