Add treatCloseAsLogout option to the API