improved error handling; Stream#close is now the only method that should muffle exceptions