What operations can take place on the databases in the other threads when you try to remove them from the main thread? Can there be cursors open on those databases or transactions that include operations on the databases?
Generally this is a sure recipe for memory leaks. The application should discard all references to the closed handle. While BDB makes an effort to discard references from closed objects to the allocated memory for an environment, this behavior is not guaranteed. The safe course of action for an application is to discard all references to closed BDB objects. If you are going to share handles for database objects across threads, you should architect your application such that there is no possibility of a thread closing a handle when another thread is using that handle.
From BDB's point of view it doesn't matter from which thread you are closing the database handle (main or not), but only a single thread may do it.