The S&P 500 closed just points from its record high as a crude oil rally distracted Wall Street from uncertainty over the Federal Reserve's rate-hike plans.

The S&P 500 was up 0.22%, closing at 2,187, three points from its record close set on Monday. The Dow Jones Industrial Average added 0.13%, and the Nasdaq rose 0.22%.

Crude oil prices rocketed higher for the sixth session in the green as hopes over a production freeze from major oil-producing countries and a draw-down in domestic inventories continued to fuel commodities. The Organization of Petroleum Exporting Countries are set to meet in September.

"OPEC members continue to allude to an output freeze later this year, however the biggest producers are already pumping near record levels so for any freeze to be material is needs to include Libya and Iran -- who both have considerable capacity to increase production," warned Joseph George, commodity analyst at Schneider Electric.

West Texas Intermediate, the U.S. benchmark, added 3.10% to $48.24 a barrel on Thursday, closing at its best level since July 1. U.S. oil closed at its best level since early July on Wednesday after weekly data showed a steeper-than-expected decline in domestic crude inventories.

The release of minutes from the July Fed meeting on Wednesday afternoon showed a split central bank. A divided Fed led to choppiness in the afternoon session with benchmark indexes buffering the flatline before breaking slightly higher. The S&P 500 closed Wednesday roughly 8 points below its all-time record close set on Monday.

The Fed has been in the spotlight this week with comments from the likes of New York Fed President William Dudley and Atlanta Fed President Dennis Lockhart keeping a September rate hike in the mix. Those comments coupled with improving economic data to suggest a U.S. economy ready for policy normalization.

A September rate hike currently has an 18% likelihood, according to CME Group fed funds futures. A December hike has greater chances with investors pricing in a 43% likelihood.

Private-prison operators plunged on Thursday afternoon after the Department of Justice announced it would end contracts with for-profit institutions. Publicly owned private prisons Corrections Corp.of America (CXW) - Get Report and GEO Group (GEO) - Get Report moved sharply lower on the news. The DOJ's decision will likely have a significant impact on performance. In 2015, for example, nearly half of GEO revenue came from the federal government.

In earnings news, Walmart (WMT) - Get Report rose nearly 2% after reporting a better-than-expected quarter, benefiting from a rebound in second-quarter consumer spending. The world's largest retailer earned an adjusted $1.07 a share, a nickel higher than estimated. Same-store sales in the U.S. rose 1.6%, better than an expected 1% increase. Walmart guided for current-quarter same-store sales growth between 1% and 1.5%.

Cisco (CSCO) - Get Report was lower slightly by nearly 1% after announcing plans to cut 5,500 workers. Reports early Wednesday suggested the tech company would cut a far more severe 14,000, or roughly 20% of its workforce.

The networking-tech developer exceeded earnings and profit estimates in its recent quarter. Fourth-quarter earnings of 63 cents a share beat forecasts by 3 cents. Revenue fell 1.6% to $12.64 billion, though crept past consensus by $70 million.

"Bottom line: We would be buyers on any post-earnings pullback (Thursday) and believe Cisco executed well in the face of a difficult backdrop," said Jim Cramer, portfolio manager of Action Alerts PLUS, and Jack Mohr, director of research. "We appreciate that management remains focused on consistent, solid execution while driving profitable growth, cash generation and operating leverage. By making tough decisions in the short term, the company is laying bricks for the long term, continuing its firm commitment to delivering shareholder value."

Cisco is a holding in Cramer's Action Alerts PLUS Charitable Trust Portfolio.

Weekly jobless claims fell to a one-month low in the past week, another sign of a robust U.S. labor market over the summer. The number of new claims for unemployment benefits fell by 4,000 to 262,000. Analysts had expected the number of new claims to hit 265,000. Jobless claims have remained under 300,000 for the past 76 weeks, the best stretch since 1970.

Business activity and outlook in the Philadelphia region improved in August, according to the Philadelphia Business Outlook Survey. The index increased to positive 2, rebounding from a reading of negative 2.9 in July.