Modify to close AttachmentInputStream