Reverse connection hacked

Bit of background
We are paying a Russian freelancer to do some work for us. He sent me his TeamViewer ID and 4 digit passcode.
After 3 attempts at failing to connect I left it trying a 4th and within about 30 seconds my 3 desktop wallpapers disappeared and he had control of mouse.
I pulled the phone line from the router to get him off.
What the heck just happened?
I can't find this online anywhere and I've been using TV for years.
Latest version on a macbook