You should be able to type
>> diary off
but better is to just use try/catch in your code to handle any possible errors so that your code does not bomb but exits in a controlled and graceful manner.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!