U.S. stocks closed with big gains Wednesday, breaking a weeklong slump. Investors were optimistic that a break would come soon in the impasse between Greece and its creditors over extending the country's bailout loans.

The Dow Jones industrial average rose 236.36 points, or 1.3 percent, to 18,000.40.

The Standard & Poor's 500 index gained 25.05 points, or 1.2 percent, to 2,105.20.

The Nasdaq composite climbed 62.82 points, or 1.3 percent, to 5,076.69.

For the week:

The Dow is up 150.94, or 0.9 percent.

The S&P 500 is up 12.37, or 0.6 percent.

The Nasdaq is up 8.23, or 0.2 percent.

For the year:

The Dow is up 177.33 points, or 1 percent.

The S&P 500 index is up 46.30 points, or 2.3 percent.

The Nasdaq is up 340.63 points, or 7.2 percent.