Gandalf was just faster then Legolas to get into the bathroom - as soon as he'll come out, Aragorn and Boromir will jump on Legolas to prevent him from going in next, while Gimli sees the chance, sprints into the bathroom and slams the door, leaving the others groaning (just Gandalf will laugh).