Fixed cursor not closed warning