Remove a ResourceWarning, close stdout explicitly.
Decode the output from the command explicitly, and keep everything as strings.