With an inland application, you must reside in Canada while it's being processed. You can leave, yes, but for no more than a couple of weeks to be safe.
If you're denied entry at the border for any reason, your application will be considered abandoned.