Add task finishing logic and open task query