[Security] fixed a leak in the ContextListener

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8244
| License       | MIT
| Doc PR        | n/a

Trying to fix leaks when using the same Kernel to handle several requests in a row without resetting the Container or shutting down the Kernel.