Listeners, closing and shutdown fixes