Removing duplication of onclose method for EncryptedFileStorage