The queen and members of the royal family closed out the four-day celebration by appearing on the balcony of Buckingham Palace.