Improved adapter disposing mechanism

- Fixed an issue that prevented a correct disposing of the adapter.
This issue caused problems while starting/stoping the adapter as a
windows service