The first reaction is Addition of grignard at acid anhydride a carbonyl compound. It reaction like described.
The second one is the reaction of grignard with a alcohol. The alcoholat with Magnesium bromide will reaction with the chlorine ans close the Ring to THF.