public void stopListening() {
        if (!isRunning)
            return;

        isRunning = false;
        while (!this.uploadFinished) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ignored) {
            }
        }
        for (Map.Entry<String, BufferedReader> entry : logFileReaders.entrySet()) {
            try {
                entry.getValue().close();
            } catch (Exception e) {
                BmLog.error("Failed to close " + entry.getKey() + " reader");
            }
        }
    }