Fix #227: close streams in test to avoid exception message in output