added looping feature to constantly reopen file