Close cursor

Close cursor to avoid resource leaks