Move loading script exit to error frame