Former US Open champion Dominic Thiem says he will retire later this year because of the wrist injury which derailed his career.