Fix ORS scripts displaying an error after completing

Change-Id: I1329705fca870b4e3017607ad7c7875aa00d664b
diff --git a/gui/action.cpp b/gui/action.cpp
index 265d6de..5a76461 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -1545,6 +1545,8 @@
 
 int GUIAction::openrecoveryscript(std::string arg)
 {
+	int op_status = 1;
+
 	operation_start("OpenRecoveryScript");
 	if (simulate) {
 		simulate_progress_bar();
@@ -1565,6 +1567,7 @@
 			gui_print("Processing OpenRecoveryScript file...\n");
 			if (OpenRecoveryScript::run_script_file() == 0) {
 				reboot = 1;
+				op_status = 0;
 			}
 		}
 		if (reboot) {
@@ -1572,11 +1575,11 @@
 			TWFunc::Disable_Stock_Recovery_Replace();
 			usleep(2000000); // Sleep for 2 seconds before rebooting
 			TWFunc::tw_reboot(rb_system);
+			usleep(5000000); // Sleep for 5 seconds to allow reboot to occur
 		} else {
 			DataManager::SetValue("tw_page_done", 1);
 		}
-		operation_end(1);
-		return 0;
+		operation_end(op_status);
 	}
 	return 0;
 }