Improved cleanup in test scripts.