Fix tests compilation
Fix many test errors
Lock mux when parsing the templates
Adapt tests to the new template groups
Close temp file