Splitting the con.close() invocation out into its own method gives the risk of forgetting to invoke that method, but at the same time opening and closing the connection provides overhead so doing it as few times as possible is generally a good idea.
Do not use the finalize() method for housekeping. They are meant for objects holding native resources, and while a connection is a native resource there is also no guarantee that they will ever run.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
a bit of art, as a gift, the permaculture playing cards