cipher: Fix memory leak when cancelling the cipher dialog