Two popular Perth beaches were closed after a great white shark was spotted swimming 20 metres offshore. File image.