US stocks end mostly flat