Usually just closing STDOUT worked. I never had to close STDERR explicitly. And I have been thinking about ways to capture error messages. The only thing I could come up with was to put an eval around the code, so that if something fails, I would know. But I would really like to be able to see warnings and such. Thanks!