done button logic for train and test tasks