Relationship Between OPEN and FREE
The database server allocates resources to prepared statements and open cursors. If you execute a FREE statement_id or FREE statement_id_var statement, you can still open the cursor associated with the freed statement ID. If you release resources with a FREE cursor_id or FREE cursor_id_var statement, however, you cannot use the cursor unless you declare the cursor again.
Similarly, if you use the SET AUTOFREE statement for one or more cursors, when the program closes the specific cursor, the database server automatically frees the cursor-related resources. In this case, you cannot use the cursor unless you declare the cursor again.