Always close outstream and not only when it is finished