mkdir_p the dir before trying to write a pickle file