Prevent race in unlisten.