Record output datasets in the task table. Fixes #4192.