python: Always properly close request handlers when exiting.