Logout during cleanup and add test for implicit flow scopes