Close outputstream when sending resource contents