Urgent Closing of Parent form

I want to close parent request (form) when all child requests (child forms) have been closed.How can i do that ?

I had done that with the help of a counter variable i.e. when a child requests raises , a counter increases by 1 and when a child requests closes , a counter decreses by 1.This worked right but it causes some replication issues.