close connection regardless of autocommit status and set conn to nul

This is a fix for the previous fix.