Move cleanup task initialization to an earlier stage, to make shutdown work as expected.