Minimized Conn Statements

Minimized the number of conn statements to ease transition into linux
and removed all conn.close() statements