What strikes many people as the most terrible aspect of suicide is the pain
What about other decisions you face? Does it strike you as strange that anyone should ultimately have any reason to act other than in the service of their own personal happiness? If so, you are challenging all moral obligations and would find it just as strange that anyone should be "literally obligated" to refrain from rape and murder.
I assume that this is not your view, that you accept some obligations toward others and are willing to take their interests into account, alongside your own, when deciding how to act. But if this is the way you think about your ordinary conduct decisions, then why should the decision about suicide be special? If your mother's feelings are a reason for you to call her on her birthday, then why are they not also a reason for refraining from suicide?
The illusion that we have no obligation to consider others' interests when contemplating suicide may arise from two sources. First, many jurisdictions forbid suicide and also assisting those who want to die. This may strike us as exceeding society's legitimate authority. A society does not own its citizens. And when a fully competent citizen wants to die, and perhaps wants a friend's help with this, then society should not stand in the way.
Agreeing with this sentiment, we may reject the intrusion of society and its law in our decision about suicide, and we may further conclude that we have no moral obligation to comply with such an (unjust) law. From this we may then falsely infer that we have no moral obligations toward others in this matter.
An analogous mistake is common with regard to freedom of speech. We strongly reject the idea that society's law may constrain what we may say or write. We express this in sentences like "I can say what I want." But on reflection we realize, nonetheless, that we sometimes say things we (morally) ought not to have said -- even if saying them was legal and rightly so. With regard to speech, then, the law ought not forbid all that it is morally wrong to express. This case shows what is not obvious: the fact that some action ought to be legally permitted is compatible with this action being morally wrong. In some cases, citizens ought to have a legal right to do the morally wrong thing. Suicide may be one such case.
The other source of the illusion is the very great pain that people contemplating suicide are typically experiencing. In comparison to this pain, the interests of others may pale to insignificance, especially for the person longing to die. To correct for this illusion, we may imagine an unusual case: a guy who is a bit bored with life, whose car mirror was damaged, and who is fighting the third pimple on his chin in a single month. He is not especially eager to live or to die, but feels mildly inclined to do himself in. When so little is at stake for him, it is easier to appreciate that the interests of others may by strong enough to tip the scales. If his parents, siblings, spouse, and children would all the totally devasted by his suicide, surely he ought to pull himself together, get that mirror repaired, fight the new pimple with aftershave, and think of doing something exciting with his family. It would be wrong for him to let his very slight preference sideline the devasting effects his suicide would have on others.
This case suggests what I think is the right answer to your query. In this matter, as in all others, we have a moral obligation to take the interests of others into account. This does not mean that we have a general obligation to stay alive for their sake. In some cases the interests of others really do pale to insignificance in comparison to one's own, and it such cases suicide is permissible, perhaps afterone has done one what can do to ease the pain of those left behind. Yet in other cases, like that of the preceding paragraph, one does have a moral obligation to stay alive for the sake of others.