What version/edition of SQL Server is this?
It's got to be auto-close somewhere. Be sure you're not getting auto-close for another instance. Code might do it, but I can't imagine anyone writing code that would close a database after you disconnected. You'd have to switch to another database to make this work.