The S&P 500 and Nasdaq closed at records with earnings season delivering a positive distraction.