Gulf leaders have signed a document at a summit in Saudi Arabia aimed at resolving a dispute between several countries and Qatar.