Fixed Buffer not shutting down properly in some cases.