If you have finished your study program, and have been accepted to another program, you can extend your current Study Permit. It is recommended, for ease of mind, to apply for the extension 3 to 4 months before the expiration of your current Study Permit.
However, as long as your Study Permit is not expired, you can still apply for the extension. The downside of applying close to the expiration date of the Study Permit, is that you will be on “implied status”, meaning that you will not be able to study or work (if you are allowed to with your permit) after your current Study Permit expires.
You will have to wait until Immigration, Refugees, and Citizenship Canada (IRCC) has approved your extension request to resume your studies.
During the “implied status” period, you will still be able to leave and re-enter Canada, as long as you have valid appropriate travel authorization (eTA for visa-exempt countries or TRV for visa-required countries). If (i) you visit the U.S. or St. Pierre and Miquelon during the implied status period, by bus, car, train or boat, and (ii) are from a TRV-required country, you will not need a valid TRV to re-enter Canada.
Make sure to travel with copies of your permit extension application documents (proof of payment, confirmation of receipt of your application by IRCC, etc.).