The US government was just hours from shutting down on Saturday as Republicans and Democrats pursued rival stopgap measures to prevent a closure that would throw into doubt everything from access to national parks to Washington’s massive support for Ukraine.