Umm Fadhl (RA) narrated:
The Prophet of Allah (SWT) went to visit a man, and he complained about his illness and wished to die. The Prophet of Islam (PBUH) told him: Do not wish for death, because if you are a good-doer, by being alive your good deeds are increased; and if you are a sinner you will be given time to repent from your sins; so do not wish for death [1].
[1] Amali Toosi, Majlis Sizdahum, Page 385.
Source:en.shafaqna.com