Nasdaq, S&P retreat from record highs as US stocks open lower