Ensure cursors are closed.