private void updateAndClose(final String initials) {
        if (!closing && getDate() != null) {
            closing = true;
            try {
                Connection conn = MySql.getConnection();
                PreparedStatement statement = conn.prepareStatement(MySql.OPENING_COUNT_UPDATE);
                final java.sql.Date date = new java.sql.Date(getDate().getTime());
                statement.setDate(1, date);
                int i = 2;
                for (Component comp : moneyPanel.getComponents()) {
                    if (comp instanceof HighlightingCurrencyField) {
                        statement.setBigDecimal(i, ((HighlightingCurrencyField) comp).getBigDecimalValue());
                        i++;
                    }
                }
                statement.setString(14, initials);
                statement.setDate(15, date);
                i = 16;
                for (Component comp : moneyPanel.getComponents()) {
                    if (comp instanceof HighlightingCurrencyField) {
                        statement.setBigDecimal(i, ((HighlightingCurrencyField) comp).getBigDecimalValue());
                        i++;
                    }
                }
                statement.setString(28, initials);
                statement.executeUpdate();
                conn.close();
                WindowEvent wev = new WindowEvent(ClosingCountWindow.this, WindowEvent.WINDOW_CLOSING);
                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
            } catch (SQLException e) {
                ErrorDialog.show("Error in data", e);
            }
            closing = false;
        }
    }