close script on successfull connect