Only clear the buffers if the network is online

Founds this lying around in my local repo and I don't recall what it was for or why it's needed so making a pull request if someone cares about this.