Do you mean your layer palet is un-docked? If so, try going to the window sub-menu at the top and try checking/unchecking the palet you want docked again.
When I go to the top where it says FILE/EDIT/DRAW/BONE/ANIMATION/SCRIPTS/WINDOW/HELP and choose window, any undocked palet will have a check mark next to it. When I uncheck it the palet snaps back to its original location. I don't mean the top of the palet, which is the only way I can get a pallet to close like you described.