Capture the OK (or error) after closing the stream, don't shutdown the module on an error (yet) since we want to capture the error code.