it works differently if you have ONE list that record both types of tasks (with a column indicating if it is parent task or sub task) or TWO lists where one is parent task and one is sub task.
if you have ONE list, then trigger when item is created or modified, condition on the column that indicates if parent or subtask, if subtask, and it is marked closed then do a "get items" on all subtasks that has the same parent task. The way you will tell if all subtask of same parent task is all closed is using Filter array on closed, and compare the length() of all vs length() of filter array, if same, then all is closed.
if you have TWO list, then trigger when item is created or modified on only the subtask list, the rest of the action is the same as mentioned above.