U.S. stocks closed higher on Tuesday in a slight recovery from the worst trading day of the year, as investors remained on edge amid the imminent Greece repayment deadline to the IMF.

The S&P 500 posted its smallest gain on record (going back to 1928) for the first half of the year, up just 0.20 percent. (Tweet This) The index ended the quarter 0.24 percent lower, ending 9 consecutive quarterly gains. That is the longest stretch since the 14-quarter streak that ended in the second quarter of 1998.