The Democratic Republic of the Congo and Rwanda have signed a deal to end their long-running conflict.