You must have a valid study permit when you apply for the work permit.
You must apply for a work permit within 90 days of receiving written confirmation (for example, a transcript or an official letter) from your institution indicating that you have met the requirements for completing your academic program.