Prevent window close when making persistence