Add task pointer to the task_post_term() function in task plugin

The terminating task's PID is available in task->pid.