[addon closebrackets] Add smart backspace behavior

When any specified pair is empty, backspacing will also
delete the closing bracket.
[closebrackets addon] Simplify backspace-handling code