Correctly terminate index task

Task status would not be deleted from open task list when finished indexing.