externalprocess: Set exit callback last to avoid hang