Postgres 11 - Fetching results after a transactiom
From what I understand, in order to use the cursor after your procedure ends, you need to be on the same transaction you was when calling the procedure.
Your code use two different transactions: the first one is started with BEGIN just before calling the procedure, and it ends at the COMMIT. The second transaction starts automatically after the COMMIT in your procedure and continue until the COMMIT after your FETCH.