integrate Ted's connection.close() to avoid leak