I would put this register_files_for_cleanup before call_payload, so you ensure the file is registered for cleanup before calling the payload.