President tweets that US has signed agreement as Mexico agrees to ‘stem the tide of migration’