Fixed potential error on unit test shutdown