You don't normally need to close stdout and stderr
It happens automatically when your script ends
here is an example using exec to redirect
if you want to save the current setting of stout and stderr
whether it be to a file or to the screen
then redirect to somefile and then redirect back to them
exec 3>&0 4>&1 >somefile 2>&1
This saves the old stdout on FD 3, and the old stderr on FD 4.
exec 1>&3 2>&4 3>&- 4>&-
This copies 3 back to stdout and 4 back to stderr, then closes the
descriptors that are no longer needed.