Precision measurement of the Xi0 mass and the branching ratios of the decays Xi0 -> Lambda gamma and Xi0 -> Sigma0 gamma