EZP-22817: Error running legacy scripts

> Fixes https://jira.ez.no/browse/EZP-22817

Stored references to the handlers weren't properly passed to the closure, resulting in the kernel being rebooted. Since some feature, such as legacy scripts, rely on those references, they were broken.

The patch changes `Kernel\Loader` references to the `ezpKernelHandler` instances to regular variables.