Fixes bug 929197 - Make sure connection closing can happen before doing it.