Stocks closed little changed on Tuesday, erasing losses in the final 20 minutes of trading, after a Greek government source said the conservative party leader would make a written commitment sought by international lenders.

Based on the latest available data, the Dow Jones industrial average <.DJI> was up 4.24 points, or 0.03 percent, at 12,878.28. The Standard & Poor's 500 Index <.SPX> was down 1.27 points, or 0.09 percent, at 1,350.50. The Nasdaq Composite Index <.IXIC> was up 0.44 point, or 0.02 percent, at 2,931.83.

(Reporting By Caroline Valetkevitch; Editing by Kenneth Barry)