The scanner does not accept the PIE_RELEASE_SCANNER command before it has reached the parking position. So this command should be called via sanei_begin_thread. However, that might not work if the Sane backends have been built with pthread support when the parent process, e.g. a forked one exits. It works with xsane and scanimage.