Serial port closes on its own

Hi, I am working on a program for logging data from ten devices at a time using a python script. The code works just fine and I am able to read all COM ports and log the data, till the last port (COM10) randomly closes by itself. This happens after random duration of time. I am unable to understand why should a COM port close on its own, without any deliberate action to close it!! Thanks!!