Check if download reply is None when closing tab.

Fixes #311.