Add detection of missing braces at the end. Fixes #16.