rename ensure fn to get-or-create
add try/catch when closing connection