Your program attempts an illegal cursor operation such as closing an unopened cursor.