public void close() {
        if (closed) return;
        FileLockRemainedException fileLockException = null;
        if (process != null) {
            try {
              killFirefoxProcess();
            } catch (FileLockRemainedException flre) {
              fileLockException = flre;
            }
        }
        if (customProfileDir != null) {
            try {
                removeCustomProfileDir();
            } catch (RuntimeException e) {
                if (fileLockException != null) {
                    LOGGER.error("Couldn't delete custom Firefox profile directory", e);
                    LOGGER.error("Perhaps caused by this exception:");
                    if (fileLockException != null) LOGGER.error("Perhaps caused by this exception:", fileLockException);
                    throw new RuntimeException("Couldn't delete custom Firefox " +
                            "profile directory, presumably because task kill failed; " +
                            "see error LOGGER!", e);
                }
                throw e;
            }
        }
        closed = true;
    }