Yes, you absolutely can if you need to. You will always have access to an exit. The game will continue without you, so you will just lose some moments in the game if you need to step out.