js: don't spin forever in bg thread on detach