I found out the cause.

To solve it, go to System Preferences > General and put a check mark next to "Close windows when quitting an application"

Should do the trick

P