Add API to release the EventStreams to InputEvents.

Because Demo.py running under X imports the application, the
EventStream is not destroyed when the application exits.
Hence the input devices are not ungrabbed, and the mouse
and keyboard no longer work in X.