echo json&exit

if($status == 'close') {
    $values = array(
                 'error_description' => 'Sorry lesson is already closed.'
              );
    die( json_encode( $values ) );
}

/*
    Write codes here if status is not close
*/
$values = array(
             'error_description' => null
          );
die( json_encode( $values ) );

What i want is when status is close, it will stop there and not process until the second die. My problem is that when status is close, it is still processing until the second die( json_encode( $values ) ); Am i doing something wrong? Thanks!