When is it appropriate to close your office door when meeting with a student? Generally speaking, keeping the door open to your office while attending with a student (or students) is a safe policy given the amount of danger one can get in should any allegations be made.  (I mention this last bit in light of the number of Title IX investigations that seem to be on the rise.)

However, is there ever an appropriate situation where closing the office door while meeting with a student or students is okay as a teacher/lecturer/professor?
This is one of those topics for which different people have different opinions. Some professors (and some programs) have no issue with meeting with students one-on-one behind closed doors. Others will avoid it whenever possible. There are many, many factors that can affect the decision - including sensitive issues such as gender, power imbalances, tenure or job security, etc. It is impossible to give one-size-fits-all advice. 

That being said, I think it is a fine practice to meet with your door open whenever possible, and simply lower your voice to avoid sharing private information such as grades.  For ordinary meetings, such as office hours, there is no serious reason to meet behind closed doors. 

For situations where there are other concerns - such as concerns about of any kind of unprofessional behavior or claims about unprofessional behavior - it is often better to ask another faculty member to be present for the meeting. Even if they do not speak, their mere presence can genuinely help defuse tense situations by keeping you and the student more calm. Moreover, the other person is also able to recount their memory of the meeting should it be necessary, avoiding some issues that can arise when only two people were present for a conversation.