can: Move mutex unlock after signal.
The pthread_cond_signal should be called with the mutex locked. Thus move the unlock after the signal.
Add an usleep(1000) before closing the CAN socket. Some drivers have some kind of race condition sending data and closing the socket.