only write to file if it is open
Merge branch 'master' of github.com:jminardi/mecode