EU cuts migration deal after marathon talks, differences remain