You'll get the passport back either as you are boarding the plane to return to your home country - or once you arrive in your home country. It does not count as a deportation provided you leave on your own. But note that you may still have challenges returning to Canada in the future.