Making laptop screen an inactive monitor

I have a dock with 2 monitors connected to it, is there a way when i close the laptop (i currently have it set to blank monitor) to make it a non-active monitor so that no programs open there? Currently I have to then go in and deactivate the laptop screen in the monitor settings, is there a way to have this happen automatically when I close the laptop and then reactivate it when I open the laptop again.