How do I leave the game when I am finished playing?

From a seated position (/sit) use the /quit command to log out gracefully. You can use /quit without sitting down also, your character will do this automatically.