Comedian Robin Williams had health problems that would have killed him within three years if he had not ended his own life, his widow has said.