US stocks end mixed midweek