NEW YORK -- The stock market closed mostly higher Thursday, helped by positive earnings out of several large U.S. companies including Apple and construction equipment maker Caterpillar.

The markets gains were modest, however, as investors turned their eyes back to Russia and Ukraine, where geopolitical tensions were heating up once again. Some earnings reports, such as 3M and Facebook, also failed to impress investors.

It was the seventh time in the last eight days that the S&P 500 has closed higher. Despite the recent upward momentum, traders remain nervous.

"Everyone is a little apprehensive as we move higher, waiting for the next shoe to drop that’s going to make the market head lower," said Jonathan Corpina, a floor trader at the New York Stock Exchange with Meridian Equity Partners. "The market isn’t in a healthy mentality at the moment."

The Standard & Poor’s 500 index rose 3.22 points, or 0.2 percent, to 1,878.61 and the Nasdaq composite rose 21.37 points, or 0.5 percent, to 4,148.34.

The Dow Jones industrial average closed at 16,501.65, unchanged on the day. The last time the Dow closed flat was Dec. 24, 2001.