[SYCL][Windows] Don't do backend calls in DLL_PROCESS_DETACH (#22277)
In Windows, ExitProcess kills spawned threads before calling
DLL_PROCESS_DETACH. This can lead to issues if the backend relies on
threads.
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess
This MS devblog recommends that DLL_PROCESS_DETACH should be as minimal
as possible.
https://devblogs.microsoft.com/oldnewthing/20120105-00/?p=8683
Additionally, if helper threads are forcibly terminated this can prevent
the stdout buffer from being flushed, so add explicit flushing of the
stdout buffer after the threads are killed.
Only cleanup early if L0 is not being used, otherwise
`UR_L0_LEAKS_DEBUG` will break.
Also extends the functionality to other libraries that may contain SYCL
objects through the `Managed` class.