Allow braces around multi-line blocks if do-end would change the meaning

Fixes #373.
Also fixes #376.