Hi Mihail,
Thanks for the reply.
I have used the following code to close all the queries, tables opened.
Sub close_all_queries()
Dim qry As DAO.QueryDef
For Each qry In CurrentDb.QueryDefs
On Error Resume Next
DoCmd.Close acQuery, qry.Name, acSaveYes...