Use cwd when .write has no directory