close serial port before exit