fixed issue where error written for last chunk. This was due to a wrong return value of false.