Fixing tests to remove temporary files