Add atexit command, fixes #281