Donald Trump and Kim Jong Un have ended their meeting in Singapore by signing a joint agreement, promising to work for peace.