Cleanedup async stuff a bit and added clean exit with closing connections