Write keyblock to file.