It sounds like you are using the "When a Task is is created" trigger. I believe that you should be using the "When a task is completed" trigger.
If you need more help, please post a screen shot of your Flow.
Remove the When a task is completed action and the actions below it from your Flow. Create a second Flow and use the When a task is completed Trigger. Send the emails from the new Flow.
You don't want more than 1 trigger in a Flow except in unusual circumstances.
I think the problem is because task is completed action dont´have a idtask, only idplan and idgroup. the idea is to trigger the e-mail only when the correct task is complete.