S&P 500 and Nasdaq notch record closes as Microsoft, Apple and Amazon hit record highs