Yes, if the PS4 is in rest mode (not turned off), it will download games. The download is unaffected by whether the PS4 is turned on or off. Under settings -> power options, you can control when the PS4 enters rest mode and how it behaves while in it.