Fix resource memory leak introduced by PreparedStatements that were not being closed