Moving the close to a finally, so that it is always run. Changing logging to Log4Dart