How does this brominated intermediate lose its methyl group? The problem is such:


  


So far my working has been:



I'm concerned about the last step where the ester forms a ring. The methyl group doesn't look like a plausible leaving group, but it does not appear in the product so how can I get rid of it?
A methyl cation definitely won’t leave by itself. However, you can consider bromide ions floating around in solution. These bromide, being nucleophilic can attack the methyl group in an $\mathrm{S_N2}$ manner, because any positively charged oxygen is a good leaving group. Therefore, the side product would be bromomethane.

Other than that, your mechanism is looking good.