Having issues with the Serial Monitor needing to be opened for my entire code to work

That's not a "proper" solution :wink:
Change

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

to

  // Open serial communications and wait for port to open:
  Serial.begin(9600);