Fix for AMQ-5249

Approach to the change is described in http://issues.apache.org/jira/browse/AMQ-5294?focusedCommentId=14077910&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14077910

For some reason there is also a commit in this pull request that was already merged (Added close destroy-method...), apologies something messed up in the workflow.