accounts: lock when writing keyFile