MEDIUM severity: The vulnerability in the Yield in Trove is lost when closing a strategy vault arises due to the fail. The vulnerability in the Yield in Trove is lost when closing a strategy vault arises due to the failure to claim funds in the trove contract during the emergency close flow. This issue occurs because the status of the system is changed to Paused and later to Closed, which prevents the compound funct...

Vulnerable code:
```\nfunction deposit(\n  GMXTypes.Store storage self,\n  GMXTypes.DepositParams memory dp,\n  bool isNative\n) external {\n    if (self.tokenA.balanceOf(address(this)) > 0) {\n        self.tokenA.safeTransfer(self.trove, self.tokenA.balanceOf(address(this)));\n    }\n    if (self.tokenB.balanceOf(address(this)) > 0) {\n        self.tokenB.safeTransfer(self.trove, self.tokenB.balanceOf(address(this)));\n    }\n}\n```\n```\nfunction withdraw(\n  GMXTypes.Store storage self,\n  GMXTypes.WithdrawParams memory wp\n) external {\n    if (self.tokenA.balanceOf(address(this)) > 0) {\n        self.tokenA.safeTransfer(self.trove, self.tokenA.balanceOf(address(this)));\n    }\n    if (self.tokenB.balanceOf(address(this)) > 0) {\n        self.tokenB.safeTransfer(self.trove, self.tokenB.balanceOf(address(this)));\n    }\n    // rest of code\n}\n```\n```\nfunction compound(\n  GMXTypes.Store storage self,\n  GMXTypes.CompoundParams memory cp\n) external {\n    if (self.tokenA.balanceOf(address(self.trove)) > 0) {\n        self.tokenA.safeTransferFrom(\n            address(self.trove),\n            address(this),\n            self.tokenA.balanceOf(address(self.trove))\n        );\n    }\n    if (self.tokenB.balanceOf(address(self.trove)) > 0) {\n        self.tokenB.safeTransferFrom(\n            address(self.trove),\n            address(this),\n            self.tokenB.balanceOf(address(self.trove))\n        );\n    }\n    GMXChecks.beforeCompoundChecks(self);\n}\n```\n```\nfunction beforeCompoundChecks(\n  GMXTypes.Store storage self\n) external view {\n    if (\n        self.status!= GMXTypes.Status.Open &&\n        self.status!= GMXTypes.Status.Compound_Failed\n    ) {\n        revert Errors.NotAllowedInCurrentVaultStatus();\n    }\n    // rest of code\n}\n```\n```\nfunction emergencyPause(\n  GMXTypes.Store storage self\n) external {\n    self.refundee = payable(msg.sender);\n\n    GMXTypes.RemoveLiquidityParams memory _rlp;\n\n    // Remove all of the vault's LP tokens\n    _rlp.lpAmt = self.lpToken.balanceOf(address(this));\n    _rlp.executionFee = msg.value;\n\n    GMXManager.removeLiquidity(\n        self,\n        _rlp\n    );\n\n    self.status = GMXTypes.Status.Paused;\n\n    emit EmergencyPause();\n}\n```\n```\nfunction emergencyClose(\n  GMXTypes.Store storage self,\n  uint256 deadline\n) external {\n  GMXChecks.beforeEmergencyCloseChecks(self);\n\n  // Repay all borrowed assets; 1e18 == 100% shareRatio to repay\n  GMXTypes.RepayParams memory _rp;\n  (\n    _rp.repayTokenAAmt,\n    _rp.repayTokenBAmt\n  ) = GMXManager.calcRepay(self, 1e18);\n\n  (\n    bool _swapNeeded,\n    address _tokenFrom,\n    address _tokenTo,\n    uint256 _tokenToAmt\n  ) = GMXManager.calcSwapForRepay(self, _rp);\n\n  if (_swapNeeded) {\n    ISwap.SwapParams memory _sp;\n    _sp.tokenIn = _tokenFrom;\n    _sp.tokenOut = _tokenTo;\n    _sp.amountIn = IERC20(_tokenFrom).balanceOf(address(this));\n    _sp.amountOut = _tokenToAmt;\n    _sp.slippage = self.minSlippage;\n    _sp.deadline = deadline;\n\n    GMXManager.swapTokensForExactTokens(self, _sp);\n  }\n\n  GMXManager.repay(\n    self,\n    _rp.repayTokenAAmt,\n    _rp.repayTokenBAmt\n  );\n\n  self.status = GMXTypes.Status.Closed;\n\n  emit EmergencyClose(\n    _rp.repayTokenAAmt,\n    _rp.repayTokenBAmt\n  );\n}\n```\n```\ncontract GMXTrove {\n\n  /* STATE VARIABLES */\n\n  // Address of the vault this trove handler is for\n  IGMXVault public vault;\n\n  /* CONSTRUCTOR */\n\n  /**\n   * @notice Initialize trove contract with associated vault address\n   * @param _vault Address of vault\n   */\n  constructor (address _vault) {\n    vault = IGMXVault(_vault);\n\n    GMXTypes.Store memory _store = vault.store();\n\n    // Set token approvals for this trove's vault contract\n    _store.tokenA.approve(address(vault), type(uint256).max);\n    _store.tokenB.approve(address(vault), type(uint256).max);\n  }\n}\n```