Fixed CBN formatting issues: MAGN-3921, MAGN-3900

This submission fixes two errors:
1. Semi-colon added after a single line comment if the comment is the last line
2. Semi-colon not added for statements ending with '}' in the last line

@ke-yu please review. Thanks