In Preferences/Power Management there is a setting for what to do when the lidcloses. It might be relevant to what you want to do.