Using finally to ensure deterministic freeing of memory in withSecureMemory