corrected a few errors in the T4 file

Fixed the following:
- if no enums were selected, then a closing curly brqacket was still
generated causing an error;
- if scope object was passed in, the connection was still called
connection.Open() causing an exception