Make sure we close the file descriptor when writing to the megam training file.
Merge pull request #402 from alexrudnick/fix_megam_file_leak

fix file descriptor leak when writing to megam training file