Add an method to cancel all tasks belonging to the closing-client, avoiding bad pointer operation in different thread.