If you switch it off with a switch you’re completely cutting the power to the bulb so the wifi component in it cannot work either and that is why you’re losing the connection. You need to switch it off via the app so it is still powered via the powerlines