Zope.testbrowser functional test with ZODB.POSException.ConnectionStateError

I am at updating pas.plugins.headers. Thanks to plone.meta and with some manual work it was not that much work ... except:

Some functional tests are failing with some strange error. These are zope.testbrowser (or derived from there plone.app.testing.zope.Browser) tests. Most of them are fine, only four are failing and I do not see why. They are very similar to the working ones!
In my branch I marked the lines 4 times with # XXX here and below:

I get a ZODB.POSException.ConnectionStateError: Shouldn't load state for persistent.list.PersistentList 0x2b526133ce083e2a when the connection is closed see Config with default template (meta) · collective/pas.plugins.headers@7ae5da5 · GitHub

The error usually appears if there is an object partially loaded and used, but the ZODB-connection was already closed before (or it was loaded in a different connection from the pool, but this is not true for tests AFAIK).

The exception happens while looking up subscribers for the EndRequestEvent event.
It happens deep into the zope.interface.adapter.. code getting _uncached_subscriptions, so those to be loaded from somewhere, i.e. also persistent site managers - which would explain at least why it need to load something there.

Any ideas whats wrong here, if this is a bug in the test or more over in plone.testing or zope.testing, zope.testbrowser and how to hunt it down?

FTR: @mauritsvanrees hint here solved it Config with default template (meta) by jensens · Pull Request #20 · collective/pas.plugins.headers · GitHub