After migrating to Hibernate 5, doWork does not close connection

I’m migrating Hibernate 3 to Hibernate 5. One difference we are using is that in Hibernate 3 doWork or doReturningWork would close the connection if it was not in a transaction, Hibernate 5 seems to not close the connection after doWork or doReturningWork.