private void writeAccount(AccountData account) throws PersistenceException {
File accountFile = new File(participantIdToFileName(account.getId()));
OutputStream file = null;
try {
file = new FileOutputStream(accountFile);
ProtoAccountData data = ProtoAccountDataSerializer.serialize(account);
file.write(data.toByteArray());
file.flush();
} catch (IOException e) {
LOG.severe("Failed to write account data to file: " + accountFile.getAbsolutePath(), e);
throw new PersistenceException(e);
} finally {