You actually can walk any direction but since the room is totally blank you may not have that feeling of being moving, however if you fought one ghost there are other two that needs to be fought as well, after that you will be taken out of the room automatically. Just wander around looking for the ghosts, you will eventually find them.
