Fix bug for closing bracket-delimited blocks