That is a
client behavior, and not the bot itself. See this
previous thread, as at one time it might have been buggy, but it should still be working fine.
Any program that kills the client or alt + f4s results in the same thing. The fact you didn't die before was just chance, since the server managed to DC you before you died those times.
When you choose Logout to character selection, which is the default behavior, it's as if you alt + f4 or choose "Exit Path of Exile". None of those chicken methods are a guaranteed logout because the game server has to process your connection closing.
If you choose "Exit to log in screen" or uncheck the option to "Chicken to Character Selection Screen", both of those result in the client sending a logout packet to the server, and then disconnecting you. I've found using that logout method is the most surefire way to ensure you get logged out, but it doesn't mean you can cheat death. If there is any sort of network delay from the time you send the packet and their servers processing it, they might think you are dead before you actually are logged out.
Sorry you lost your character, but there's a lot of things that happen in this game that make botting in Hardcore a real challenge. Desync alone is enough of a hardcore character killer in this game, and that strongly affects the bot. If you decide to keep botting in hardcore, I'd suggest taking it small steps in a time, test the waters to see how things go with your build, and configure settings appropriately.