Added interrupt support, for closing the application cleanly.