Closing all temporary file handles properly