Improved test directory cleanup.