use try/except around file creation