Fix close code for JBoss