You can close an open cursor by executing the CLOSE_CURSOR procedure of the DBMS_SQL package.
The example in the following listing, from the ANYSTRING procedure, shows that the
procedure uses the cursor ID value as its sole input parameter:
Closing a cursor frees the memory used by the cursor and reduces the number of concurrently open cursors in your session.
Unless you need very detailed control over the steps involved in executing dynamic SQL, you should use the EXECUTE IMMEDIATE approach.