Cosmin,
I'm assuming that you are running your script though the ArcPy window, am I correct? If so, why not using IDLE or PythonWin instead? That way you would not need to open up an ArcMap session to do what you need to do, you would just refer to your map document object instead:
mxd = arcpy.mapping.MapDocument(<mxd path>)
Your issue description does not tell me why you need to "close" ArcMap. If you could elaborate then I might be able to help.