Create root if doesnt exist and add close function in tests