[PATCH v5 1/3] kernelbase: Close key only if it was successfully opened.