Help with Automation to Lock Door After 4 Minutes only when it's Closed

Post your automation in YAML format, not as a screenshot.

FAQ Guideline 11 - Format it properly
FAQ Guideline 14 - Screenshots