Adjust the last close bracket index as opposed to the line length.

This prevents the case where the last "close bracket" was being found
on empty lines, because they would have a length of -1 (which was also
the position of the close bracket if it were not found on that line)