leave directory before removing