correctly close cursor
clear error after setting result from calculator