This should avoid the crash caused by the CacheOutputCloseListener being
fired on the main thread too late during shutdown by keeping the
previous behaviour when on the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D165062