Thank you for your message.
You can decide if you want to lock the user session after closing the TeamViewer session within the TeamViewer toolbar or within the TeamViewer options of your device.
You will find all the information you need how to proceed in our Knowledge Base article here, in section X - Closing the session: All about the TeamViewer Remote Session Toolbar / X - Closing the session
I hope this could help. If not, do not hesitate to ask your questions here.