refactored to idiomatic usage of filechannel api
Merge pull request #645 from lassewesth/filewriteimprovement

refactored to idiomatic usage of filechannel api