Write_file not working