tweak order of thread shutdown