Added tests for database manual open/close. Added mock memory allocator.