Dimuth Karunaratne has played his last knock as a Test cricketer, the 36-year-old dismissed by Matt Kuhnemann in Galle.