Hard to know for sure without more info, but most likely your problem is this: Damage happens in a specific order. The poison damage occurs before the Antimattered Scarab has a chance to heal you, and the game ends the instant you reach 0 health or less.