Dangling opened database cursor has been closed