close ByteArrayOutputStream instead of flush