U.S. stocks give up morning gains to close mixed