Fixed so that Arduino continues to read bytes even if it has given the command to stop transmitting. It can now empty the buffer without freezing.