erase extra lines before '}'