Fix bug in merge() function

If output stream is destroyed input streams are now properly destroyed, too.
There was a typo. :-)