Improve error reporting for unclosed blocks