Let $X$ be a locally finite CW-complex and let $U$ be an open subset of $X$. Given a non-zero homotopy class $x\in\pi_i(U)$ say, is it possible to find a closed subset $Z\subset U$ whose removal from $U$ kills the class $x$ without creating any new homotopy classes: $$\pi_i(U\backslash Z) = \pi_i(U)/\langle x \rangle, \quad \pi_j(U\backslash Z) = \pi_j(U)\quad \mathrm{for} \quad j\neq i.$$ Is a question like this tackled in the literature somewhere?

Example: Let $X = S^1\times [0,1]$. For $U = S^1\times (0,1)$ and $x\in\pi_1(U)$ we can take $Z$ to be an embedded open interval from one end of the cylinder to the other: $Z = \{y\}\times (0,1)$ for any $y\in S^1$.

I think my class $x\in\pi_i(U)$ had better be a generator as I suspect killing $x^2$ by this method would also kill $x$. At the end of the day, I would like to find a collection of disjoint closed subsets such that if you remove them all the resulting space is contactible.