Merge pull request #287 from kiryl/development filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE