If statement not reading boolean properly

My code below is not working for some reason and I cant figure out what the problem is. I trying to run the openh() function when I press button 1 if the status bool is false. and once it runs it should set the status bool to true and then I can press button 2 and run closeh() if status is true, (and set to false once done). simple stuff. the problem is - I start the program, press button 1, openh() runs, the motor goes through its rotation. When its done I press button 2 and nothing happens. If I press button 0 which reverses the status bool, and then press button 2, closeh() runs. Once closeh() is done i press button 1 and openh() runs. No need to press button 0 after running closeh(). So it runs if I reverse status bool to true manually but it doesn’t run when function openh() sets it to true.

#include <Stepper.h>
#include <IRremote.h>
#include <DS3231.h>

#define Button_1 0xFFA25D
#define Button_2 0xFF629D
#define Button_3 0xFFE21D
#define Button_4 0xFF22DD
#define Button_5 0xFF02FD
#define Button_6 0xFFC23D
#define Button_7 0xFFE01F
#define Button_8 0xFFA857
#define Button_9 0xFF906F
#define Button_0 0xFF9867


//variables 
int counter;
String now;
bool state=false;
int receiver = 7;
IRrecv irrecv(receiver);
decode_results results;


//constant variables
const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution


// initialize
Stepper hStepper(stepsPerRevolution, 8, 9, 10, 11);

DS3231  rtc(SDA, SCL);


void setup() {
  // set the speed in rpm:
  hStepper.setSpeed(250);
  
  // initialize the serial port:
  Serial.begin(9600);

  irrecv.enableIRIn();

  rtc.begin();
     // The following lines can be uncommented to set the date and time
  //rtc.setDOW(TUESDAY);     // Set Day-of-Week to SUNDAY
  //rtc.setTime(23, 59, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(15, 12, 2020);   // Set the date to January 1st, 2014
}




void loop() {

  if (irrecv.decode(&results)){

    irrecv.resume();
    
    if (results.value == Button_1){
      if (state == false){
        openh();
      }
    }

    if (results.value == Button_2){
      if (state == true) {
        closeh();
      }
    }

    if (results.value == Button_0){
      
      if(state==false){
        state=true;
      }
      else if (state==true){
        state=false;
      }
      }
    }
  

   now = rtc.getTimeStr();
  if (now==("16:15:00")){
  closeh();
  }

 // Serial.println(rtc.getTimeStr());
 //delay(1000);

}


int openh(){


    hStepper.setSpeed(250);

for(counter=0; counter <= 100; counter++){
  hStepper.step(stepsPerRevolution);
}
  state = true;   
}


int closeh(){

    hStepper.setSpeed(250);

for(counter=0; counter <= 100; counter++){
  hStepper.step(-stepsPerRevolution);
}
  state=false; 
}

Firstly, you can shorten your code by using ! (logical not) operator.
Change:

if (state == false) {
  state = true;
}
else if (state == true) {
  state = false;
}

By a single line of code :

state = !state;

Secondly, try changing the below line and similar lines:

if (results.value == Button_0)

to

if (results.value == (uint32_t)Button_0)

Start by printing each of the variables that you are testing just before the if statements. Are the values what you expect ?

Shouldn’t the resume be the last thing you do, not the first?