Added appropriate OS-specific error-checking in TestWriteSystemIdentityFile() of agent/identity_test.go