fix possible race condition when deleting a manager. Make worker behavior predictable when calling run then shutdown