Fix various warnings about unclosed files etc. There's still hundreds of warnings coming from inside ReportLab and PIL