move output file opening to backend

Different backends have different requirements.
diff --git a/lang_wireshark.py b/lang_wireshark.py
index 9f73543..509c9cd 100644
--- a/lang_wireshark.py
+++ b/lang_wireshark.py
@@ -36,8 +36,15 @@
 loaded automatically by Wireshark.
 """
 
+import os
+import loxi_utils.loxi_utils as loxi_utils
 import wireshark_gen
 
 targets = {
     'wireshark/openflow.lua' : wireshark_gen.generate
 }
+
+def generate():
+    for (name, fn) in targets.items():
+        with loxi_utils.open_output(name) as outfile:
+            fn(outfile, os.path.basename(name))