Added test for new write_chunks_to_file behaviour in #1376.