For some reason, context manager for tempfile clean up is not working.