Resolve cursor close exception

Resolve crash http://crashes.to/s/3eea6333d97