I came across a reaction whereby a 1-5 dicarboxylic acid is converted to lactone with $\ce{SOCl2}$. I was wondering what the mechanism of this was.
I know that $\ce{SOCl2}$ converts carboxylic acids to acyl chlorides. Is it the case that one carboxylic acid undergoes this transformation, then the oxygen from the $\ce{OH}$ of the other carboxylic acid attacks the acyl chloride, making the $\ce{Cl}$ a leaving group?
Is this the case or am I missing something?