Close transactions if are requireds

@param int $status
184980
protected function closeTransaction($status)
    {
        if(null !== $this->con) {
            $this->traceDebugQuery();
            if (null !== $this->con && $this->con->inTransaction()) {
                if ($status === 200) {
                    $this->con->commit();
                } else {
                    $this->con->rollBack();
                }
            }
            Propel::closeConnections();
        }
    }
1108245
public function closeConnection()
    {
        $this->db_connected = false;
        $this->db_index     = 0;

        // release statement and connection resources
        $this->last_result  = null;
        $this->dbh          = null;
        $this->dbhs         = array();
    }
1259808
private function removeDataFromSalesOrderStatusState($setup, $statuses)
    {
        foreach ($statuses as $status) {
            $setup->getConnection()
                ->delete($setup->getTable(''), "status='$status'");
        }
    }
869071
public function setStatus( $status )
	{
		if ( $status == $this->getStatus() ) { return; }

		$this->_values['status'] = (int) $status;
		$this->setModified();
	}
818502
public function stop($data = false, $status = null){

        $this->exit = true;

        if ($status) {
           $this->response->status = $status;
        }

        if ($data) {
            $this->response->body = $data;
        }

        if (\is_numeric($data) && isset(self::$statusCodes[$data])) {

            $this->response->status = $data;

            if ($this->response->mime == 'json') {
                $this->response->body = \json_encode(['error' => self::$statusCodes[$data]]);
            } else {
                $this->response->body = self::$statusCodes[$data];
            }
        }

        if ($data || $status) {
            echo $this->response->flush();
        }

        exit;
    }
194544
public void dispose() {
        try {
            connection.close();
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
        } finally {
            isActive = false;
            connection = null;
            JdbcRepository.TX.set(null);
        }
    }
1212922
public function setStatus($status)
    {
        if ($status && $this->enabled->get()) {
            try {
                $this->lastUpdate = time();
                $this->openSession($this->serverLogin->get(), $this->apikey->get());
            } catch (\Exception $e) {
                echo $e->getMessage();
            }
        }
    }
101775
public void afterCompletion(int status) {
		switch (status) {
			case Status.STATUS_COMMITTED:
				txContext.run();
				break;
			default:				
		}
		TransactionContextThreadLocal.setTransactionContext(null);
	}
1193663
public function end(EdgarCron $edgarCron, int $status = EdgarCronRepository::STATUS_OK)
    {
        $this->repository->end($edgarCron, $status);
    }
620978
public function quit($status) {
        if($this->died) {
            return;
        }
        $this->died = true;
        if($status) echo $status;
        throw new \Exception('die');
    }
624978
private function close($resource)
    {
        if (is_resource($resource)) {
            fclose($resource);
        }

        if (is_resource($this->process)) {
            proc_close($this->process);
            $this->process = null;
        }

        $this->stdin->close();
    }
21971
public function withStatus(string $status): self
    {
        $this->status = ScheduledActionStatusEnum::ensureValid($status);
        return $this;
    }
1175103
protected function endTransaction($commit) {
    $tx = $this->getPersistenceFacade()->getTransaction();
    if ($this->startedTransaction && $tx->isActive()) {
      if ($commit) {
        $tx->commit();
      }
      else {
        $tx->rollback();
      }
    }
    $this->startedTransaction = false;
  }
1218232
public static function checkStatus($status) {
        switch ($status) {
            case self::STATUS_UNMATCHED_SHARED_SECRET:
                return UnmatchedSharedSecretException::getClass();
            default:
                return parent::checkStatus($status);
        }
    }
769029
protected function _setOrderStatus($status)
    {
        $paymentTypeObject = $this->getPaymentType();
        $paymentType = $paymentTypeObject ? $paymentTypeObject->getFieldData('oxpaymentsid') : null;
        if ($paymentType != 'oxidpaypal' || $status != self::OEPAYPAL_TRANSACTION_STATUS_OK) {
            parent::_setOrderStatus($status);
        }
    }
1261772
protected function setStatusStore($status)
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (!isset($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (isset($id)) {

            if (!is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            $result = $this->store->update($id, array('status' => $status));

        } else if (!empty($all)) {

            $updated = $count = 0;
            foreach ((array) $this->store->getList() as $store) {
                $count++;
                $updated += (int) $this->store->update($store['store_id'], array('status' => $status));
            }

            $result = $count && $count == $updated;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
342943
public function clearStatus(/** @noinspection PhpUnusedParameterInspection */ SaleClearStatusEvent $event)
    {
        $con = Propel::getWriteConnection(SaleTableMap::DATABASE_NAME);
        $con->beginTransaction();

        try {
            // Set the active status of all Sales to false
            SaleQuery::create()
                ->filterByActive(true)
                ->update([ 'Active' => false ], $con)
            ;

            // Reset all sale status on PSE
            ProductSaleElementsQuery::create()
                ->filterByPromo(true)
                ->update([ 'Promo' => false], $con)
            ;

            $con->commit();
        } catch (PropelException $e) {
            $con->rollback();
            throw $e;
        }
    }