fix a bug in multi-threaded code
close the stream after we're done with it
small cleanup in maude backend
close stream, print stack traces instead of ignoring the exception