I experienced this issue recently on a Ubuntu 20.04 installation. Using the System Monitor application I killed the teamviewerd process, which was not stopping when the GUI application was closed. Once that process was killed and the application restarted via the GUI TeamViewer connected immediately. I had also opened TCP/ UDP port 5938 on ufw.
... View more