Calibre does not create a valid .bib file

When a user uses a trailing curly brace in bibtex comment field, it creates an invalid bibtex file. 
https://bugs.launchpad.net/calibre/+bug/1228905

This fix strips out orphan curly braces, while leaving matching braces in place.