Fixed Broken Tests and Database close