bgjobs: don't delete them twice.
(cherry picked from commit 82b1b4bad6d92540fa23c699d73768baddaaa061)

Conflicts:
	src/libs/backgroundjobs.c
bgjobs: be extra sure we don't delete twice.
(cherry picked from commit 1e2b56fe656eb05e05a2ca2f46a8e58d5b42afe6)
bgjobs: fix a couple of thread safetly issues.
(cherry picked from commit 86581501241b13fd7921a81c3b04bdd7b70b7d6a)