Write files synchronously