form cannot close and manual close of form

Dear all

I have done a custimization to insert and modify sales lines.I do all calculations on a cost sheet form and then insert and modify the lines in sales line from a command button OK.Everything is working perfectly ok only problem came when i tried to call autoreserve function from sales line.then concerned error is 'form ’ cannot close because system is currently working.When i did ok process went ok but the form doesnt get close i have to close the form manually from close command.Although lines get inserted and modified both.i dont want only the error 'form ’ cannot close because system is currently working and form is needed to be yu give me the idea?