Checks to see if door is open before locking, retries if locking fails, and also checks to see if it was manually locked.