public void close() {
        logger.info("closing destination '"+filename+"'");
        try {
            if (w.equals(null) || w == null) {
                w.flush();
                w.close();
            }
        } catch (Exception ex) {
                ex.printStackTrace();
        }
    }