Fixes segfault caused by accessing destroyed logging object when test fi...

...le is successfully removed.