close cursor after last job