US stocks close mixed, surrendering earlier gains