S&P 500 and Nasdaq finish week at record high