Remove trailing spaces on auto generated backup names

Trailing spaces sometimes cause folder creation depending on what
file system is in use (e.g. vfat).
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index c39a6b2..1c0ad75 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1016,6 +1016,13 @@
 			Backup_Name += " " + propvalue;
 			if (Backup_Name.size() > MAX_BACKUP_NAME_LEN)
 				Backup_Name.resize(MAX_BACKUP_NAME_LEN);
+			// Trailing spaces cause problems on some file systems, so remove them
+			string space_check, space = " ";
+			space_check = Backup_Name.substr(Backup_Name.size() - 1, 1);
+			while (space_check == space) {
+				Backup_Name.resize(Backup_Name.size() - 1);
+				space_check = Backup_Name.substr(Backup_Name.size() - 1, 1);
+			}
 			DataManager::SetValue(TW_BACKUP_NAME, Backup_Name);
 			break;
 		}