[ros-diffs] [gschneider] 36815: Initialize variables and close keys only if they were opened, based on wine code. Fixes CIDs 787, 788.