I would suggest that maybe this is a problem with the DBD::mysql module. The disconnect method does what you'd expect it to do, or at least that's what it's intended to do.
Your code above will not run on my Win32 system using DBD::ODBC for my connection. It chokes on the prepare because $dbh is no longer a valid database handle.