Aside from the question of why a spelunking group is carrying a flare gun in the first place, when Sara shoots a pursuing centipede in the mouth, it falls back into the water and the flare extinguishes. Flares carry their own oxygen supply, somewhat like solid-fuel rockets do, and are fully capable of staying lit underwater or in rainy conditions.