add event listener for error on window to reload