Can I leave the country while my residency is pending?
Yes, but when your residency is pending you must apply for a re-entry permit.
This permit can be precessed online or in person. It is a procedure for foreigners who have already applied for residency, but have not been granted it yet, and want travel outside the country with the intention of returning to it.