job: Only decrease refcount after `settmode` in `job_wait`

This is required to prevent the scenario explained by @akkartik in #1324