Fix index out of bounds for OffsetMatcher

Fix for exception triggered when removing the last curly bracket.