US stocks end with modest losses after early plunge