Prevent destroy() from being executed if the loop is not running