close cursor for database