How do I make OS X require my password immediately after the display is put to sleep?
By design the first action system does is to save your work in a large file (depending what you had going on) so to be able to wake up exactly to where you left of. Once that is done the next step is to lock it with password.

That action does require time (writing the image), so if you are very quick you can catch your system in the writing action.

Here is a example:

Close lid-->

11/15/14 07:54:30.000 WindowServer[86]: device_generate_desktop_screenshot: authw 0x0(0), shield 0x7fdfc2449050(2001)

11/15/14 07:54:30.038 WindowServer[86]: device_generate_lock_screen_screenshot: authw 0x0(0), shield 0x7fdfc2449050(2001)


Open lid-->

11/15/14 07:54:33.928 WindowServer[86]: CGXDisplayDidWakeNotification [174799469151647]: posting kCGSDisplayDidWake
11/15/14 07:54:33.929 WindowServer[86]: handle_will_sleep_auth_and_shield_windows: Deferring.