private void closeOpenReport() throws Exception {
        LedgerOverview ledgerOverview = getLedgerOverview();
        if (ledgerOverview == null) {
            throw new Exception("Could not find ledger overview.");
        }
        String ledgerUri = null;
        for (String uri : ledgerOverview.uris) {
            if (uri.contains(this.ledger)) {
                ledgerUri = uri;
                break;
            }
        }
        if (ledgerUri == null) {
            throw new Exception("Could not find selected ledger.");
        }
        LedgerDetail ledgerDetail = getLedgerDetail();
        ReportInfo reportInfo = getReportInfoFromOpenUri(ledgerDetail.open_report_uri);
        if (reportInfo == null || !reportInfo.status.equals("open")) {
            throw new Exception("Already closed or closing report.");
        }
        closeReportFromOpenUri(ledgerDetail.open_report_uri);
        this.openReportUri = ledgerDetail.open_report_uri;
        reportInfo = getReportInfoFromOpenUri(this.openReportUri);
        if (reportInfo == null || (!reportInfo.status.equals("closing") && !reportInfo.status.equals("closed"))) {
            throw new Exception("Close report failed.");
        }
        checkReportClosedWithTimer();
    }