Fix cursor close after key retrieval.