When the error occurred, I noticed the following message on stdout:
initialise_event_info_struct: initialise failed!
This is a known bug in nrjavaserial:
https://github.com/NeuronRobotics/nrjavaserial/issues/111
I applied the suggested fix to disable locking in the native libraries and it seems to sucessfully work around the Could not get port identifier, maybe insufficient permissions.
issue.