public void writeTextATermFile(ISourceLocation loc, IValue value, IEvaluatorContext ctx){
OutputStream out = null;
try{
out = ctx.getResolverRegistry().getOutputStream(loc.getURI(), false);
new ATermWriter().write(value, new OutputStreamWriter(out, "UTF8"));
}catch(IOException e){
throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
}finally{
if(out != null){
try{