If a program that should encrypt information on exit crashes
<p>Let's say you have a mail client that stores messages, addresses etc. on the hard drive. These messages are inside encrypted files, but when you sign in they are decrypted so you can access the data inside them.</p>

<p>When you log out these files should be encrypted again. This is easily done if one exits the program successfully, but if somebody pulls the power out of the computer or the program crashes, the instructions to encrypt will not be executed.</p>

<p>Is there a solution to this? If you have any language-specific way to overcome this, I'm using Java.</p>
