Don't join threads that are already dead.

Refs #4990
Add missing newlines.

Refs #4990
Merge branch 'feature/freebsd-tests-4990' into next

Fixes #4990