clean up in onDestroy even if not finishing. add back sample size limit for determining in-memory vs file, fix record directory regression