U.S. crude briefly hit a 1-week low in morning trade after weekly crude oil inventories unexpectedly showed a build, up 2.6 million barrels.
Oil gained Tuesday but turned lower in late trade after the American Petroleum Institute showed an inventory build of 2.9 million barrels, compared to analysts' expectations for a decline.
The Dow transports closed down more than 1 percent, giving up an intraday attempt to halve losses.
Read MoreOil slammed on supply, set up for more losses
"I think the most important factor here is we're at year-end. There isn't much volume so it's very easy to move markets either way," said Peter Cardillo, chief market economist at First Standard Financial.
U.S. markets wrap up the last week of trade for the year on Thursday, and are closed Friday for New Year's Day.
As of Wednesday's close, the S&P 500 was up 0.22 percent year-to-date, while the Dow Jones industrial average was down 1.23 percent for the year so far. The Nasdaq composite was up 6.96 percent for 2015.
Read MoreCountdown with Cashin: Watch for this year-end phenomenon
After Wednesday's late-afternoon decline, the major U.S. averages are on pace for slight weekly gains of less than half a percent.
The U.S. dollar held mildly higher against major world currencies, with the euro near $1.093 and the yen at 120.50 yen against the greenback.
In a light day of economic reports, pending home sales fell 0.9 percent in November from an upwardly revised October reading, according to the National Association of Realtors.
Treasury yields held below highs reached Tuesday, when the two-year yield topped 1.1 percent for the first time since April 2010.
The 2-year yield was around 1.07 percent and the 10-year yield near 2.30 percent in the close.
The Treasury auctioned $29 billion in 7-year notes of 2.161 percent. The bid-to-cover ratio, an indicator of demand, was 2.34, below the average 2.46, according to StreetAccount.
Read MoreEarly movers: KBIO, PBY, DD, COP, SEAS, FB & more
European equities ended lower, with the German DAX underperforming with a decline of more than 1 percent.
Asian stocks closed mixed. The Nikkei 225 and Shanghai composite ended slightly higher, while the Hang Seng closed lower.
U.S. stocks closed up more than 1 percent Tuesday as the tech sector led broad gains amid some stabilization in oil and commodity prices.