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
CLOSE_CURSOR procedure uses the cursor ID value as its sole input parameter:
DBMS_SQL.CLOSE_CURSOR(Cursor_Name);
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.