I closed all the windows and then locked the door.
A. Having closed all the windows, I locked the door.
B. Having locked the door, I closed all the windows.
C. Having locked the door, then all the windows were closed.
D. Having closed all the windows, then the door was locked.