TensorRT
                                
                                 TensorRT copied to clipboard
                                
                                    TensorRT copied to clipboard
                            
                            
                            
                        ```trtexec``` fails at the end if ```--saveEngine``` path is invalid or unwritable
Description
When running trtexec with the --saveEngine flag pointing to an invalid or unwritable path, the tool proceeds to parse the ONNX model and build the engine. However, it only fails at the very end when attempting to serialize the engine, wasting time and resources.
This issue is created to introduce the following pull request: #4449
Environment
This issue should occur regardless of the system configuration.
Steps To Reproduce
trtexec --onnx=model.onnx --saveEngine=/invalid_path/engine.trt