"write" function

I made this code nearly a year ago, but since then learned how git actually works.  So, here's a pull request, in case you're interested in having a simple way to output .reg files!

I also moved / renamed the "open" command, but I cannot recall why - if you want, I can remove that bit, and can possibly also squash my commit messages if they are annoying.