It is usually advised not to switch on or off any of the electric switches if you detect a gas leakage. It is because the fumes of gas are highly flammable and even the smallest of sparks, due to switching of the electric switch, can ignite a huge fire.