I am sorry for my incorrectness and unclearness.
The dialog should be as follows:
A:Нужно закрыть дверь.
B: (Silence)
A: Нужно закрыть.
B: (Silence)
A: Закрывать!
A tells B to shut the door twice but B does not react so A emphasizes the command by using the imperfective infinitive.
Is the dialog correct grammatically?