use writeFile instead of managing a file handle