HHH-8930 Make the rebuildSessionFactory() method be more aggressive about closing