remove javascript error when page unloaded before loading is complete