Further spit & polish

- _get_template_from_file doesn't close fh as per comments
- _get_template_from_file does block reads
- _get_template_from_file null terminates
- changed template to tmpl since it confuses a c++ compiler even in
extern C
- another mem leak in  _process_modifiers
- added extern C