Actor Robin Williams was struggling with a brain disorder that was not immediately diagnosed, causing many of the bizarre symptoms that sapped him of his vitality and ultimately led him to take his own life.

That’s according to a new biography, Robin (Henry Holt & Co.) by Dave Itzkoff that’s out this month and details the final stages of Williams’s life.

Williams was initially diagnosed with Parkinson’s disease, but his behaviors in his last year were uncharacteristic of that malady, leading some to blame drugs or alcohol for his problem. Finally, a neuropathologist saw him and correctly diagnosed his affliction: diffuse Lewy body dementia. It is the second-most-common type of progressive dementia after Alzheimer’s disease, as protein deposits in the brain affect thinking, memory, emotions and body movements.

Williams began to cry uncontrollably, forget his lines, and suffer from a shuffling gait in his last days, according to the book. During the filming of Night at the Museum: Secret of the Tomb,” he reached a crisis point.