Suppose you discovered you had an uncontrollable compulsion towards some heinous crime. I have heard, for instance, of some people who at least report that they cannot stop themselves from committing certain crimes, such as murder, rape, and child molestation. Further suppose you didn't want to turn yourself in for the crimes you already had committed, and spend the remainder of your life in prison. Yet, at the same time, you didn't want to harm any more people. Suicide might be moral under those conditions. Especially if no one depended on you, your death would not shatter anyone's life, etc.