Added function to write the slaves file.