Deal with the possibility that threads are, during development,
killed with abort/0. We recreate the worker to avoid that eventually
we run out of workers. If we are aborted due to a halt/0 call,
thread_create/3 will raise a permission error.
The first clause deals with the possibility that we cannot write to
user_error
. This is possible when Prolog is started as a service
using some service managers. Would be nice if we could write an
error, but where?