add taskFinished function, now can close window properly