I thought you had to do some magic involving walking left for a little while before reaching the right edge. I'm sure a few times I reached the right edge only to be told I was dead.
It looks as though that was a bug which is now fixed. If your current level started with a . or a ~, you would die when you finished it (but that one wouldn't kill you at any other point). Now all levels start with a ' '.