My class teacher says charge kept outside a closed surface will not hold any flux because number of field lines entering are same as number of field lines exiting. But when I imagine sufficiently big large large cuboid where field lines enter one side and exit from opposite side, they should leave some flux in closed surface, $E$ depends on $r'$ and $r$ at point of entry is not same as $r'$ at point of exit for field lines. Does the statement charge kept outside closed surface does not hold any flux holds good for all situations without assumptions of size of source charge and its relation to distance of closed surface?
Imagine it this way, keep a charge $q$ near the cube and let the field lines enter the cube. Now we know that field is a function of $r$ and varies as $1/r^2$ for a point charge which means that electric field should not be zero unless $r$ is infinite and if it is not zero, the field lines entering will be equal to field lines exiting although the intensity of field will be less for the field line exiting than the field lines entering.
We can also prove this by Gauss law which states that the flux inside a gaussian surface is $q/\epsilon$ and if there is no charge inside a gaussian surface flux would be zero.
(1) If there is net electric flux through the closed surface then some electric field lines either originate or terminate within the volume enclosed.
(2) If no electric field lines originate or terminate within the volume enclosed, all of the field lines entering the volume exit the volume and there is thus zero net electric flux through the closed surface.
(3) But, if there is no charge enclosed, no electric field lines originate or terminate within the volume.
Thus, if there is no charge within the volume enclosed, there is no net flux through the closed surface.