Most of the time, it's the pressure they build up in their minds that makes them take such steps, and the pressure is caused because the money they have lost either wasn't theirs or they couldn't afford to lose it. If you have $10,000 and have saved it for something in your life that you have been planning for years, and you suddenly lose all that money in gambling. Your emotions will drive you crazy after such a thing, and once you lose control of your mind, you won't be able to think critically.
Let us say you are an incredibly rich person. You have millions in your bank account and millions more in the forms of assets. If you gamble and lose $10,000, it won’t affect you that much. Yes, you’ll probably still be bummed because who wants to lose right? You can afford to lose or not, you wouldn’t want to lose the money. The difference is that the rich ones can easily move on while you would be in debt after losing. So, be careful also to who you take inspiration from because you do not know the extent of their financial situation.
It is also said that a person loses their ability to think or understand anything 15 minutes before they commit suicide, which is why nothing comes in front of them once they have made their mind, and they do it without having any mercy on themselves and on the ones that love them because a sane person would always think about their family before they take such an extreme step.
The only thing to prevent them is if someone had. But clearly he was alone in time of doing that no one could have helped.