If you leave Switzerland permanently and move to a member state of the EU or EFTA where you are still subject to compulsory insurance, it is not possible to pay out the mandatory portion of your vested benefits assets. It therefore remains in the vested benefits account and can only be paid out when you reach ordinary AHV/AVS retirement age. You can have the extra-mandatory part paid out when you leave Switzerland.
If you move to a country outside the EU/EFTA, you can withdraw the entire vested benefits assets.
You are not sure whether you are subject to compulsory insurance in your new country of residence? The best way to find out is to contact the BVG Guarantee Fund.