This looks like an issue with the stored proc you are calling.
Have you checked with the DB team if the stored procedure is designed correctly to handle cursors and does not close them prematurely.? The cursor should remain open until all data is fetched.