fixed writing of resulting forests into a file
fixes #717