vm/image.cpp: Better error for opening a file for writing.
io.files.temp.macosx: Create the cache and temp directories every time. Fixes #1089.