Hi,
You could do the following steps provided by the link below.
Check the solutions area.
https://learn.microsoft.com/en-us/office365/troubleshoot/sign-in/cannot-sign-out-cloud-service
If you still can't leave an organization, you could contact tenant's support.