S&P 500, Dow hit record highs as defensive shares shine