fixed afterHook to close database

	Commit by: Simon