moved OpenTaskFile to its own function