Close a cursor when empty, preventing strictmode voilation