Delaying a continuewith until a list of jobs are complete

We have a list a jobs that enqueued throw a foreach loop. I then want a final job to be run but not until all tests are completed. The problem I’m having is sometimes the final job that was queued from the loop will finish before the others in queue and my continuewith runs while the other jobs are still running. Thank you for your help.

lastJob = BackgroundJob.Enqueue(() => StartJob());

BackgroundJob.ContinueWith(lastJob, () => RunFinalJob());