refactor POSIX loading and saving so it works properly in parallel