Question
LrShutdownApp invoked at the wrong time on Windows
Documenting for future reference: LrShutdownApp is invoked when LR is shutting down. But on Windows, when LR exits and starts a backup, it first puts the API into some kind of shutdown state, where calls return the error "Attempt to make a request on a closed server." Then it calls LrShutdownApp, which is too late.
The workaround is to wrap the background tasks with LrTasks.pcall() and just ignore that particular error.