Improve option parsing and cleanup on exit (#5055)
Improve option parsing and cleanup on exit (#5055)

Minor improvements wiht no user interface changes. Manual and system tests ok.

Signed-off-by: Federico Valeri <e0ef437f0b4a80802c061a653495847cf4fe3a5c@gmail.com>
scholzj/barnabas,scholzj/barnabas,ppatierno/kaas,ppatierno/kaas