US stocks have closed higher, with investors relieved that Donald Trump did not start his second term with blanket tariff increases.