Windows minimizing and re-expanding after completing script