JBTM-1426 Updated to close the preparedstatement, and fix a bug where an rs and a statement were not closed