sr: [00:00.046088] hwdriver: Cleaning up all drivers.
sr: [00:00.046108] serial: Closing serial port /dev/ttyACM0.
sr: [00:00.046116] serial-libsp: Cannot close unopened serial port /dev/ttyACM0.
So, before closing a second time, check if the device is not idle.
I am optimistic this could fix bugs #1151 and #1275, too.