clearTask method
Clears a task from the state map and cancels it if running.
Implementation
void clearTask(String id) {
tasks.remove(id);
taskWeights.remove(id);
taskProgress.remove(id);
_cleanupTimers[id]?.cancel();
_cleanupTimers.remove(id);
cancelTask(id);
}