also end the task on 'close' and 'finish'