https://issues.apache.org/jira/browse/AMQ-4889

Improve the stream close logic in the init method to ensure we don't
leak and resources.