Instead of putting errors into the translated Android.mk file where they are unlikely to be seen and may cause strange build behavior, make all errors fatal. Also buffer to a byte buffer and then write to the output file once we are sure there are no errors. Change-Id: I247f405dd0a7c1d14c2681f86c7ac626e035ac2c