EU and UK agree on Brexit transition period