def METHOD_NAME(testcase):
  """Close the issue on GitHub, when the same issue is closed on Monorail."""
  if not _issue_recorded(testcase):
    return
  access_token = _get_access_token()
  issue = _get_issue(testcase, access_token)
  if not issue:
    logs.log_error('Unable to locate and close the issue.')
    return
  if issue.state == 'closed':
    logs.log(f'issue number {testcase.github_issue_num} '
             f'in GitHub repository {testcase.github_repo_id} '
             'is already closed.')
    return
  _close_issue_with_comment(testcase, issue)
  logs.log(f'Closed issue number {testcase.github_issue_num} '
           f'in GitHub repository {testcase.github_repo_id}.')