Generalized OpenFile method instead of WriteOpener
Fix tmpdir prefix