[matchbrackets addon] Fix highlighting of brackets when scan reaches end/start of doc

Issue #2442