Ok! I figured out the problem. Windows responds slowly to the scripts request and even before the serial open request is actually processed the complete script is executed and the control exits from the program. I tried introducing a time delay in the python script for 2 seconds - between the time the serial port is opened and its written to - this seems to work.