Make shutting down and restarting the library possible.
Fix OSX not being able to reconnect to device on close and open.
Avoid crash by invalidating timer before stopping run loop.