When a player clicks exit in the menu to leave the game. It does not mean you are off for good. There's a 3-minute cooldown that leaves the player character standing in the place of where the player logged out. It will have the player's name with "(off)" next to the name telling other players that a player recently left the game.
While the player's character is standing there, it is possible for the character to be harmed. If the player held items, that player could be stolen from as well. This basically means anything could happen to the player as if he/she was still online.
This is in the game to prevent combat logging, a term known about players who log off to avoid any combat that is happening, or will happen. To avoid any danger that could happen to your offline character, it would be best to log out in an isolated place where other players cannot go to (for an example Tents) or log out in a protected city with no items in your inventory to complete a safe full logout.