Added file check...

hope os.queueEvent("terminate") will work