wrapping cleanup in try-catch for tests