improve testing of temp_dir
only remove directories created with makedirs