Clean up orphaned tasks logs

Addresses #229

Without this, tasklogs will accumulate over time and eventually fill up
the master's disk.
Not strictly necessary. If the directory cannot be opened, the whole task will fail with an exception anyway. It does make for a nicer error message, though.

Although if we do this, we'd better wrap the whole rest of the task into the try-block.