Avoid leaking a task in tests