Fix index out of bounds for OffsetMatcher

Fix for exception triggered when removing the last curly bracket.

TODO:
- [ ] line number for the curly bracket is still incorrect

Note:
- classes to look for bugs : ErrorCheckerService and OffsetMatcher