extracted file_write from compiler to utils and surround it by tests