Close stream if file size is too large