Stocks closed higher on Wall Street but only after giving up much of the ground they won earlier in the day. Good news on jobless claims and healthy earnings from name-brand companies like Royal Caribbean and Harley-Davidson encouraged investors to buy stocks.