kill proccess using serial port

C++
fuser -k /dev/ttyUSB9

Source

Also in C++: