How to log users out when they close the browser

I tried setting SESSION_EXPIRE_AT_BROWSER_CLOSE = True but it didn’t work.

When I set SESSION_COOKIE_AGE, the user will be logged out when they are idle for a certain amount of time, which is not really desirable, and if I set SESSION_COOKIE_AGE to a short period like 1 hour, it will cause a fatal error, in some cases the instructor can load the course outline in Studio but can’t make changes because the CMS API is not authenticated. I’m not sure why, my guess is that the lms cookie is still valid while the cms cookie has expired.

My openedx: tutor v20.