close directory after clearing files