exitwhen: fix deadlock