Your tax liability in Switzerland ends as soon as you give up tax residence. You then have to complete a tax return for the portion of the tax year which you spent in Switzerland.
For example, if you were to leave Switzerland on September 1, you would complete a tax return for January 1 to September 1. You would declare your income for that period of time.
To determine your tax bracket, the tax office estimates what your annual income would be, based on your income during the portion of the year when you were a tax resident.
You become liable to pay taxes immediately at the time that you leave. The Swiss tax office will send you the relevant forms and bills. However, the process may take some time to complete, so part of the correspondence may carry over to your new (foreign) address. You can contact your Swiss tax office in advance and inform them about your upcoming move. This gives them time to process your Swiss taxes ahead of your move.