posix: don't segfault when calling ThreadsWait() without a valid thread