Fixed the unclosed cursors.