Made program actually close when automatic refresh fails