tidying filehandle closing.
Turning on perl warnings, and associated cleanup