Add exception on failure to write key files