bug fixing, DIR structs are not closed after traverse