script/save_basis.py: make sure that output directory exists