proper exit on error or success