US stocks end mixed midweek; Nasdaq posts record close