Set notify_on_release to 1. Check pointers before freeing them.

The release agent is now called when all tasks in the cgroup finish.