JBTM-1879 Updated to make sure that we close the connection to the datab...

...ase