move file writing from gui file handler into consoleserver,
and actually write the file before subjecting it to AST