UK and EU reach trade deal ending months of arguments