add method to close task.