It looks like a bug to me. I am not sure whether it's a bug in the code or in the docs.
The file is replaced when the parse method returns, so any print after this is not sent to the proper filehanlde (the temp file that will then replace the original file). I think it could be done when the twig is destroyed, when it goes out of scope or when the progam exits, but I am a bit worried about causing problems in existing code if I do this.
I usually use parsefile_inplace with flush, this way the data is flushed at the end of the parse. This requires flush to be called during the parse though so if you don't have handlers, your code should look like this (ugly!):
my $twig = XML::Twig->new( pretty_print => 'indented', twig_handlers
+ =. { 'level(1) => { sub { $_->flush} });
$twig->parsefile_inplace ( $file, $ext) ;
# no ->print after this
Alternatively, if you don't need handlers, you could also use perl -i to do this, using parsefile and print.