fix bug in search patients
close cursors
close cursor