We weren't correctly ending the ( ) block when encountering an error. Testcases added. Fixes #2281
31066a69