I'm not sure what you mean by "closing the query". How are you seeing these queries as "open"? I run multiple SQL queries in my applications, and when I'm done I call close database connection, as Jim indicated. Open tables can be closed with close(<tbl-handle>, nosave) as Mark showed.
This is an example of what I do:
dbc = create database connection("<connection-string>");
sql1 = "SELECT sysdate FROM DUAL";
dt1 = execute sql(dbc, sql1, invisible);
sql2 = "SELECT COUNT(*) FROM all_tables";
dt2 = execute sql(dbc, sql2, invisible);
close database connection(dbc);
Can you share your code?