use connection.close callback
Refactoring
Extracted statements creation