update python script and have delay after close