Hotfix/session mutability

Fixes issues introduced earlier this week when we added the ability to call the session's writeClose() method on shutdown. Doing it in `__destruct` caused issues, so @mwillbanks has moved it to a `register_shutdown_function`, which ensures the original issue is fixed, while simultaneously fixing the regression.

In this PR, I also made it possible to inject the PRG plugin with a session manager, to make mocking and test isolation easier.