closing stream instead of object