Dow Jones Index
A board shows the Dow Jones Industrial Average after the closing bell over the floor of the New York Stock Exchange on Jan. 24, 2014. Reuters/Brendan McDermid

U.S. stocks closed slightly lower Thursday after a volatile day. Traders appeared unable to decide what direction to go as Federal Reserve officials appear to be hinting strongly at raising interest rates later this year for the first time in nearly a decade.

The Dow Jones Industrial Index (INDEXDJX:.DJI) closed down 36.87 points, or 0.20 percent, to 18,126.12. The Standard & Poor's 500 (INDEXNASDAQ:.IXIC) dropped 2.69 points, or 0.13 percent, to 2,120.79. The Nasdaq composite (INDEXSP:.INX) lost 8.62 points, or 0.17 percent, to hit 5,097.98. The Nasdaq hit an all-time high on Wednesday, a day after the biggest selloff of the month.

Speaking at an event at the Monetary Authority of Singapore on Thursday before markets opened, John Williams, president of the San Francisco Fed, echoed comments by Fed Chairwoman Janet Yellen, who hinted at a rate hike that could come within months.

"We're going to be ... likely raising interest rates later this year, raising them gradually over the next few years," Williams said during a Q&A session, according to Reuters. A rate hike will change the landscape of the markets, most notably by increasing the cost of borrowing, from small business loans to credit cards APRs.

Adding to uncertainty on Thursday is the situation in Greece. No deal has yet been struck to to keep the European Union member from bankruptcy, which would drive markets down on fear of a Greece exit from the euro zone. U.S. stocks followed European markets down early in the day and they didn’t recover enough to end up in the black.

Oil prices rebounded from negative territory on news that U.S. stockpiles declined for a fourth consecutive week. The Energy Information Administration said Thursday crude oil inventories declined by 2.8 million barrels over the past week, more than analysts’ expectations. Lower inventories mean U.S. producers that have shut down their rigs could see prices high enough to begin pumping again.

U.S. crude prices need to be about $60 a barrel before drillers make a profit. West Texas Intermediate for July delivery increased 0.83 percent to $57.99. Brent crude rose 1.34 percent to $62.89.